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

New: [AEA-4497] - deploy cognito #138

Open
wants to merge 186 commits into
base: main
Choose a base branch
from
Open

New: [AEA-4497] - deploy cognito #138

wants to merge 186 commits into from

Conversation

anthony-nhs
Copy link
Collaborator

@anthony-nhs anthony-nhs commented Nov 1, 2024

Summary

  • Routine Change

Details

  • deploy resources for cognito

Orkastrated and others added 30 commits September 26, 2024 14:46
…d updates references to source code for cf functions
…d updates references to source code for cf functions
Copy link

sonarcloud bot commented Nov 7, 2024

import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {

Choose a reason for hiding this comment

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

does it?

setIsSignedIn(true)
const currentUser = await getCurrentUser();
setUser(currentUser);
}

Choose a reason for hiding this comment

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

Indentation gone awry here

setError("An error has ocurred during the OAuth flow.");
break;
case "customOAuthState":
setCustomState(payload.data); // this is the customState provided on signInWithRedirect function

Choose a reason for hiding this comment

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

odd that we're capturing these and not showing them anywhere

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

Choose a reason for hiding this comment

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

This seems like an unnecessary dependency to be dragging along

props.mockOidcIssuer === undefined
) {
throw new Error("Attempt to use mock oidc but variables are not defined")
}

Choose a reason for hiding this comment

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

This seems a bit OTT, we're not doing the same checks for the primary props.

OAuthScope.COGNITO_ADMIN
],
callbackUrls: [
"http://localhost:3000/auth/",

Choose a reason for hiding this comment

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

this feels like it should be conditional, only present for internal-dev of something

})

const supportedIdentityProviders: Array<UserPoolClientIdentityProvider> = [
UserPoolClientIdentityProvider.COGNITO,

Choose a reason for hiding this comment

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

Why are we allowing Cognito itself to be an identity provider? I thought we said that real CIS2 and mock auth would be all we need.

userPoolWebClient.node.addDependency(primaryPoolIdentityProvider)
if (props.useMockOidc) {
userPoolWebClient.node.addDependency(mockPoolIdentityProvider)
}

Choose a reason for hiding this comment

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

This seems like overkill, they are directly referenced in the definition of the client, do we definitely need the explicit dependency as well?

props.mockOidcIssuer === undefined
) {
throw new Error("Attempt to use mock oidc but variables are not defined")
}

Choose a reason for hiding this comment

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

as above

principals: [
new AccountRootPrincipal
],
resources: ["*"]

Choose a reason for hiding this comment

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

declaring resources on this is meaningless, can we just remove this property?

"kms:Encrypt",
"kms:GenerateDataKey*"
],
resources:["*"]

Choose a reason for hiding this comment

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

as above

]
})
})
jwtKmsKey.addAlias(`alias/${props.stackName}-jwtKmsKey`)

Choose a reason for hiding this comment

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

this is creating a duplicate alias, the "alias" property directly on the key is already making one.

actions: [
"secretsmanager:PutSecretValue"
],
resources:["*"]

Choose a reason for hiding this comment

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

as above

oidcjwksEndpoint: props.mockOidcjwksEndpoint,
jwtPrivateKeyArn: mockJwtPrivateKey.secretArn,
userInfoEndpoint: props.mockOidcUserInfoEndpoint,
useSignedJWT: "false",

Choose a reason for hiding this comment

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

If we're not using a signed jwt, why do we need a jwt private key?

readonly table: TableV2
}

export class DynamodbResources extends Construct {

Choose a reason for hiding this comment

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

I'm not sure why we're separating these into their own file. Why not just declare them in packages/cdk/resources/Dynamodb.ts

const authorizer = new CognitoUserPoolsAuthorizer(this, "Authorizer", {
authorizerName: "cognitoAuth",
cognitoUserPools: [props.userPool],
identitySource: "method.request.header.authorization"

Choose a reason for hiding this comment

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

I think this is the default, we could be explicit but I think I would prefer specify the minimum we can

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.

4 participants