Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CVAT authentication #5147

Merged
merged 26 commits into from
Nov 5, 2022
Merged

CVAT authentication #5147

merged 26 commits into from
Nov 5, 2022

Conversation

Marishka17
Copy link
Contributor

@Marishka17 Marishka17 commented Oct 20, 2022

Motivation and context

PR contains changes to support social authentication with google and github providers. Also several bugs with related field were fixed. Resolved issue #4820. There is now possible to request another mail with email confirmation link.
Resolved issue #4832 with attempt to confirm email one more time with the same confirmation link.
I guess this issue #4837 can also be closed because now we can send another confirmation email.

How has this been tested?

Manually

Checklist

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

@Marishka17
Copy link
Contributor Author

/check

@github-actions
Copy link
Contributor

github-actions bot commented Oct 25, 2022

❌ Some checks failed
📄 See logs here

@cvat-ai cvat-ai deleted a comment from github-actions bot Oct 26, 2022
@Marishka17
Copy link
Contributor Author

/check

@github-actions
Copy link
Contributor

github-actions bot commented Oct 26, 2022

✔️ All checks completed successfully
📄 See logs here

cvat/apps/iam/views.py Outdated Show resolved Hide resolved
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Email Confirmation</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please make sure the template is correctly rendered in the popular email clients like gmail, apple mail, etc

}
)
@action(detail=False, methods=['GET'], url_path='advanced-auth', permission_classes=[])
def advanced_authentication(request):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this endpoint be a part of IAM app?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess no, because it's part of server configuration

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Marishka17 , I agree that the question is very ambiguous. But I also think that it is more IAM configuration than the server. I will prefer to have something like /api/auth/methods or something similar.

cvat/apps/iam/views.py Outdated Show resolved Hide resolved
@@ -571,3 +575,47 @@ def add_ssh_keys():
'SCHEMA_PATH_PREFIX': '/api',
'SCHEMA_PATH_PREFIX_TRIM': False,
}

# allauth configuration
USE_ALLAUTH_SOCIAL_ACCOUNTS = strtobool(os.getenv('USE_ALLAUTH_SOCIAL_ACCOUNTS') or 'False')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or 'False' is really need here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if an env variable is set to empty string then strtobool will not be able to convert it to bool

docker-compose.yml Outdated Show resolved Hide resolved
@klakhov klakhov mentioned this pull request Oct 28, 2022
7 tasks
@Marishka17 Marishka17 changed the title [WIP] CVAT authentication CVAT authentication Oct 28, 2022
@nmanovic
Copy link
Contributor

/check

@github-actions
Copy link
Contributor

github-actions bot commented Oct 29, 2022

✔️ All checks completed successfully
📄 See logs here

@Marishka17
Copy link
Contributor Author

/check

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2022

✔️ All checks completed successfully
📄 See logs here

@@ -574,3 +579,52 @@ def add_ssh_keys():
'SCHEMA_PATH_PREFIX': '/api',
'SCHEMA_PATH_PREFIX_TRIM': False,
}

# allauth configuration
USE_ALLAUTH_SOCIAL_ACCOUNTS = strtobool(os.getenv('USE_ALLAUTH_SOCIAL_ACCOUNTS') or 'False')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
USE_ALLAUTH_SOCIAL_ACCOUNTS = strtobool(os.getenv('USE_ALLAUTH_SOCIAL_ACCOUNTS') or 'False')
USE_ALLAUTH_SOCIAL_ACCOUNTS = strtobool(os.getenv('USE_ALLAUTH_SOCIAL_ACCOUNTS', 'False'))

SOCIALACCOUNT_QUERY_EMAIL = True
SOCIALACCOUNT_CALLBACK_CANCELLED_URL = '/auth/login'

GITHUB_CALLBACK_URL = 'http://localhost:8080/api/auth/github/login/callback/'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Marishka17 , Can we avoid specifying here http://localhost:8080 and calculate it automatically in runtime?

@@ -14,6 +14,15 @@ export type StringObject = {
[index: string]: string;
};

enum AdvancedAuthMethods {
GOOGLE_ACCOUNT_AUTHENTICATION = 'GOOGLE_ACCOUNT_AUTHENTICATION',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Marishka17 , @bsekachev , do you think we can avoid duplication? We get the same information from the server. I will prefer to have a REST API method to get all the necessary information from the server to render UI. Now we have a list of available methods on the server and UI at the same time.

@nmanovic
Copy link
Contributor

nmanovic commented Nov 5, 2022

@Marishka17 , let's merge as is. But I expect that you fix the comments in your next PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants