-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Update documentation for social authentication with Amazon Cognito #8557
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -106,32 +106,61 @@ There are 2 basic steps to enable GitHub account authentication. | |||||||||
> but don't forget to add required permissions. | ||||||||||
> <br>In the **Permission** > **Account permissions** > **Email addresses** must be set to **read-only**. | ||||||||||
|
||||||||||
## Enable authentication with an Amazon Cognito | ||||||||||
|
||||||||||
To enable authentication, do the following: | ||||||||||
|
||||||||||
1. Create a user pool. For more information, | ||||||||||
see [Amazon Cognito user pools](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools.html) | ||||||||||
2. Fill in the name field, set the homepage URL (for example: `https://localhost:8080`), | ||||||||||
and authentication callback URL (for example: `https://localhost:8080/api/auth/social/amazon-cognito/login/callback/`). | ||||||||||
3. Create conпiguration file in CVAT: | ||||||||||
|
||||||||||
1. Create the `auth_config.yml` file with the following content: | ||||||||||
## Enable Authentication with Amazon Cognito | ||||||||||
|
||||||||||
To enable authentication with Amazon Cognito for your CVAT instance, you need to complete two main steps: | ||||||||||
|
||||||||||
1. **Create and configure an [Amazon Cognito user pool](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools.html)**. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this is really the right approach here. I would assume a sizable fraction of users who want to configure authentication via Cognito already have a pool there. The whole point of Cognito is to share users between multiple apps, so unless you're only starting to set up SSO and CVAT happens to be your first app, you would already have a pool. Given this, perhaps it would be better to focus this section on configuring an existing pool, and add an optional extra step in front that tells people to create a new pool if they don't have one. |
||||||||||
Follow these detailed steps to set up the user pool: | ||||||||||
- Create a user pool. For example, you might use settings like those shown in the image below: | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to start in the middle. I would assume the first step would be "go to the AWS Management Console", then "click XXX to go to Cognito settings"... Also, the steps should be in a numbered list, since they are sequential. |
||||||||||
![](/images/cognito_pool_1.png) | ||||||||||
|
||||||||||
- Configure a new app on the step `Integrate your app`: | ||||||||||
- Select the `Confidential client` type, as CVAT securely stores | ||||||||||
client secrets on the server side. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
(_Note_: the `Public client` type is also supported.) | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why add this note? CVAT is a confidential client, Cognito supports confidential clients... there's no reason to configure it as a public client. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I know, but there was such a situation when the customer configured a public client instead of a confidential one. I decided to mention that, but okay, I'll delete this mention. |
||||||||||
- Enter a name for your app client. | ||||||||||
- Choose the `Generate a client secret` option. | ||||||||||
![](/images/cognito_pool_2.png) | ||||||||||
|
||||||||||
- Once your pool is configured, go to the `App integration` tab | ||||||||||
on the pool details page and then to the `Domain` section. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
Create either a custom domain or Cognito domain (e.g., `https://cvat.auth.us-east-1.amazoncognito.com`). | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||
Copy this domain as you'll need it later when configuring the `auth_config.yml` file for CVAT. | ||||||||||
|
||||||||||
- Scroll down to the `App client list` section, find the app you created, and open its settings. | ||||||||||
Edit the `Hosted UI` settings: | ||||||||||
- `Allowed callback URLs`: add a callback URL (`<http|https>://<cvat_domain>/api/auth/social/amazon-cognito/login/callback/`) | ||||||||||
- `Identity providers`: select `Cognito user pool` | ||||||||||
- `OAuth 2.0 grant types`: select `Authorization code grant` | ||||||||||
- `OpenID Connect scopes`: select the following scopes: `OpenID`, `Profile`, `Email` | ||||||||||
![](/images/cognito_pool_3.png) | ||||||||||
|
||||||||||
2. **Configure social authentication in CVAT**: | ||||||||||
- Create the `auth_config.yml` file in CVAT with the following content: | ||||||||||
|
||||||||||
```yaml | ||||||||||
--- | ||||||||||
social_account: | ||||||||||
enabled: true | ||||||||||
amazon_cognito: | ||||||||||
client_id: <some_client_id> | ||||||||||
client_secret: <some_client_secret> | ||||||||||
domain: https://<domain-prefix>.auth.us-east-1.amazoncognito.com | ||||||||||
client_id: <client_id> | ||||||||||
client_secret: <client_secret> | ||||||||||
domain: <custom-domain> or | ||||||||||
https://<custom-cognito-prefix>.auth.us-east-1.amazoncognito.com | ||||||||||
``` | ||||||||||
The client_id and client_secret can be found on the app details page, | ||||||||||
while the domain value can be found on the pool details page. | ||||||||||
|
||||||||||
2. Set `AUTH_CONFIG_PATH="<path_to_auth_config>` environment variable. | ||||||||||
|
||||||||||
3. In a terminal, run the following command: | ||||||||||
- Set the required environment variables: | ||||||||||
|
||||||||||
```bash | ||||||||||
docker compose -f docker-compose.yml -f docker-compose.dev.yml -f docker-compose.override.yml up -d --build | ||||||||||
export AUTH_CONFIG_PATH="<path_to_auth_config>" | ||||||||||
export CVAT_HOST="<cvat_host>" | ||||||||||
# schema: http|https, CVAT_PORT is optional | ||||||||||
export CVAT_BASE_URL="<SCHEMA>://${CVAT_HOST}:<CVAT_PORT>" | ||||||||||
Comment on lines
+160
to
+161
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The other placeholders are lowercase, so |
||||||||||
``` | ||||||||||
|
||||||||||
Start the CVAT enterprise instance as usual. | ||||||||||
That's it! On the CVAT login page, you should now see the option `Continue with Amazon Cognito`. | ||||||||||
![](/images/login_page_with_amazon_cognito.png) |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "CVAT" would make more sense as the client name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other headings don't use title case.