-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See [CHANGELOG](https://github.com/aws/aws-cdk/blob/bump/1.159.0/CHANGELOG.md)
- Loading branch information
Showing
328 changed files
with
3,862 additions
and
675 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/@aws-cdk/aws-cloudfront/test/distribution-lambda.integ.snapshot/cdk.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"version":"17.0.0"} | ||
{"version":"20.0.0"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/@aws-cdk/aws-cloudfront/test/distribution-lambda.integ.snapshot/integ.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/@aws-cdk/aws-codedeploy/test/lambda/deployment-group.integ.snapshot/cdk.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"version":"17.0.0"} | ||
{"version":"20.0.0"} |
4 changes: 2 additions & 2 deletions
4
packages/@aws-cdk/aws-codedeploy/test/lambda/deployment-group.integ.snapshot/integ.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
157 changes: 157 additions & 0 deletions
157
packages/@aws-cdk/aws-cognito/lib/user-pool-idps/oidc.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
import { Names, Token } from '@aws-cdk/core'; | ||
import { Construct } from 'constructs'; | ||
import { CfnUserPoolIdentityProvider } from '../cognito.generated'; | ||
import { UserPoolIdentityProviderProps } from './base'; | ||
import { UserPoolIdentityProviderBase } from './private/user-pool-idp-base'; | ||
|
||
/** | ||
* Properties to initialize UserPoolIdentityProviderOidc | ||
*/ | ||
export interface UserPoolIdentityProviderOidcProps extends UserPoolIdentityProviderProps { | ||
/** | ||
* The client id | ||
*/ | ||
readonly clientId: string; | ||
|
||
/** | ||
* The client secret | ||
*/ | ||
readonly clientSecret: string; | ||
|
||
/** | ||
* Issuer URL | ||
*/ | ||
readonly issuerUrl: string; | ||
|
||
/** | ||
* The name of the provider | ||
* | ||
* @default - the unique ID of the construct | ||
*/ | ||
readonly name?: string; | ||
|
||
/** | ||
* The OAuth 2.0 scopes that you will request from OpenID Connect. Scopes are | ||
* groups of OpenID Connect user attributes to exchange with your app. | ||
* | ||
* @default ['openid'] | ||
*/ | ||
readonly scopes?: string[]; | ||
|
||
/** | ||
* Identifiers | ||
* | ||
* Identifiers can be used to redirect users to the correct IdP in multitenant apps. | ||
* | ||
* @default - no identifiers used | ||
*/ | ||
readonly identifiers?: string[] | ||
|
||
/** | ||
* The method to use to request attributes | ||
* | ||
* @default OidcAttributeRequestMethod.GET | ||
*/ | ||
readonly attributeRequestMethod?: OidcAttributeRequestMethod | ||
|
||
/** | ||
* OpenID connect endpoints | ||
* | ||
* @default - auto discovered with issuer URL | ||
*/ | ||
readonly endpoints?: OidcEndpoints; | ||
} | ||
|
||
/** | ||
* OpenID Connect endpoints | ||
*/ | ||
export interface OidcEndpoints { | ||
/** | ||
* Authorization endpoint | ||
*/ | ||
readonly authorization: string; | ||
|
||
/** | ||
* Token endpoint | ||
*/ | ||
readonly token: string; | ||
|
||
/** | ||
* UserInfo endpoint | ||
*/ | ||
readonly userInfo: string; | ||
|
||
/** | ||
* Jwks_uri endpoint | ||
*/ | ||
readonly jwksUri: string; | ||
} | ||
|
||
/** | ||
* The method to use to request attributes | ||
*/ | ||
export enum OidcAttributeRequestMethod { | ||
/** GET */ | ||
GET = 'GET', | ||
/** POST */ | ||
POST = 'POST' | ||
} | ||
|
||
/** | ||
* Represents a identity provider that integrates with OpenID Connect | ||
* @resource AWS::Cognito::UserPoolIdentityProvider | ||
*/ | ||
export class UserPoolIdentityProviderOidc extends UserPoolIdentityProviderBase { | ||
public readonly providerName: string; | ||
|
||
constructor(scope: Construct, id: string, props: UserPoolIdentityProviderOidcProps) { | ||
super(scope, id, props); | ||
|
||
if (props.name && !Token.isUnresolved(props.name) && (props.name.length < 3 || props.name.length > 32)) { | ||
throw new Error(`Expected provider name to be between 3 and 32 characters, received ${props.name} (${props.name.length} characters)`); | ||
} | ||
|
||
const scopes = props.scopes ?? ['openid']; | ||
|
||
const resource = new CfnUserPoolIdentityProvider(this, 'Resource', { | ||
userPoolId: props.userPool.userPoolId, | ||
providerName: this.getProviderName(props.name), | ||
providerType: 'OIDC', | ||
providerDetails: { | ||
client_id: props.clientId, | ||
client_secret: props.clientSecret, | ||
authorize_scopes: scopes.join(' '), | ||
attributes_request_method: props.attributeRequestMethod ?? OidcAttributeRequestMethod.GET, | ||
oidc_issuer: props.issuerUrl, | ||
authorize_url: props.endpoints?.authorization, | ||
token_url: props.endpoints?.token, | ||
attributes_url: props.endpoints?.userInfo, | ||
jwks_uri: props.endpoints?.jwksUri, | ||
}, | ||
idpIdentifiers: props.identifiers, | ||
attributeMapping: super.configureAttributeMapping(), | ||
}); | ||
|
||
this.providerName = super.getResourceNameAttribute(resource.ref); | ||
} | ||
|
||
private getProviderName(name?: string): string { | ||
if (name) { | ||
if (!Token.isUnresolved(name) && (name.length < 3 || name.length > 32)) { | ||
throw new Error(`Expected provider name to be between 3 and 32 characters, received ${name} (${name.length} characters)`); | ||
} | ||
return name; | ||
} | ||
|
||
const uniqueId = Names.uniqueId(this); | ||
|
||
if (uniqueId.length < 3) { | ||
return `${uniqueId}oidc`; | ||
} | ||
|
||
if (uniqueId.length > 32) { | ||
return uniqueId.substring(0, 16) + uniqueId.substring(uniqueId.length - 16); | ||
} | ||
return uniqueId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.