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

🛂 POC integration with Identity Center and EntraID in the AP UI #4271

Closed
3 of 4 tasks
Tracked by #1132
michaeljcollinsuk opened this issue May 7, 2024 · 5 comments
Closed
3 of 4 tasks
Tracked by #1132

Comments

@michaeljcollinsuk
Copy link
Contributor

michaeljcollinsuk commented May 7, 2024

User Story

As a developer
I want to create a POC of the integration with Identity Centre and EntraID in the UI
So that I can confirm that it will suit our needs

Value / Purpose

Confirm that we can use Identity Centre and EntraID together to log users in to the AP

Useful Contacts

No response

User Types

No response

Hypothesis

No response

Proposal

Create a POC integration with Identity Centre and Entra ID in the AP UI.
The POC should allow us to:

  • visit the homepage of the UI
  • Click a login button
  • User is able to authenticate with EntraID/Identity Centre
  • The user is logged in and redirected back to the AP UI

Additional Information

No response

Definition of Done

  • Code written to integrate with Identity Centre via EntraID
  • Unit tests to cover the login process, with external calls mocked
  • Click through test to confirm a user can log in to the UI successfully
  • Confirm users exist in Identity Centre and EntraID
@michaeljcollinsuk michaeljcollinsuk changed the title 📖 POC integration with Identity Centre and EntraID in the AP UI 🛂 POC integration with Identity Centre and EntraID in the AP UI May 7, 2024
@Ed-Bajo
Copy link

Ed-Bajo commented May 14, 2024

Ticket blocked until identity centre work is complete.

@bagg3rs bagg3rs changed the title 🛂 POC integration with Identity Centre and EntraID in the AP UI 🛂 POC integration with Identity Center and EntraID in the AP UI Jun 11, 2024
@julialawrence
Copy link
Contributor

Identity work is complete. This ticket is now unblocked.

@michaeljcollinsuk michaeljcollinsuk moved this from 👀 TODO to 🚀 In Progress in Analytical Platform Jul 12, 2024
@michaeljcollinsuk michaeljcollinsuk self-assigned this Jul 12, 2024
@michaeljcollinsuk
Copy link
Contributor Author

Excalidraw diagram with planned next steps to test OIDC flow https://mojdt.slack.com/archives/C06NFN4FMNG/p1720797293431939

@michaeljcollinsuk
Copy link
Contributor Author

Initial work has been pushed to a draft PR here https://github.com/ministryofjustice/analytical-platform-ui/pull/212/files

We have been able to:

  • Exchange a users Entra ID token for an AWS ID token
  • Use the AWS ID token to make an STS assume role call to retrieve AWS credentials

We have not been able to:

  • Use those returned credentials to make subsequent successful calls to aws services e.g. to Athena

Currently we are:

  • Looking into errors related to the user not having access to the athena workgroups: An error occurred (InvalidRequestException) when calling the StartQueryExecution operation: You do not have access to primary. After your AWS administrator has updated your permissions, please try again.

@michaeljcollinsuk
Copy link
Contributor Author

michaeljcollinsuk commented Jul 22, 2024

When attempting to use the returned AWS token to make requests to AWS services e.g. grant lake formation permissions to another user:

    # where credentials are those returned from assuming IAM bearer role after successful token exchange
    lf = boto3.client("lakeformation", **credentials, region_name="eu-west-2") 
    grant = lf.grant_permissions(
        CatalogId='123456789', # the AWS account id e.g. ap-dev
        Principal={
         # Identity Store ID of a user. The ID is included in the ID token from AWS as the 'sub', the full ARN is returned from the "describe_user" quicksight API call
            "DataLakePrincipalIdentifier": "arn:aws:identitystore:::user/123-abc-456-def",
        },
        Resource={
            'Database': {
                'CatalogId': '123456789', # the AWS account id e.g ap-dev
                'Name': 'example-database' # database that the user had grantable permissions on 
            }
        },
        Permissions=['ALL']
    )

This failed with the following error:

botocore.errorfactory.AccessDeniedException: An error occurred (AccessDeniedException) when calling the GrantPermissions operation: Identity Center Session can't be used for this operation.

@YvanMOJdigital YvanMOJdigital closed this as completed by moving to 🎉 Done in Analytical Platform Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

4 participants