-
Notifications
You must be signed in to change notification settings - Fork 4k
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
chore(apigateway): improve docs and default value settings for identity source in authorizer #28214
chore(apigateway): improve docs and default value settings for identity source in authorizer #28214
Conversation
@@ -78,7 +80,7 @@ export class CognitoUserPoolsAuthorizer extends Authorizer implements IAuthorize | |||
type: 'COGNITO_USER_POOLS', | |||
providerArns: props.cognitoUserPools.map(userPool => userPool.userPoolArn), | |||
authorizerResultTtlInSeconds: props.resultsCacheTtl?.toSeconds(), | |||
identitySource: props.identitySource || 'method.request.header.Authorization', | |||
identitySource: props.identitySource || IdentitySource.header('Authorization'), |
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 change caused by this is guaranteed by this test.
@@ -216,7 +218,7 @@ export class TokenAuthorizer extends LambdaAuthorizer { | |||
authorizerUri: lambdaAuthorizerArn(props.handler), | |||
authorizerCredentials: props.assumeRole?.roleArn, | |||
authorizerResultTtlInSeconds: props.resultsCacheTtl?.toSeconds() ?? Duration.minutes(5).toSeconds(), | |||
identitySource: props.identitySource || 'method.request.header.Authorization', | |||
identitySource: props.identitySource || IdentitySource.header('Authorization'), |
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 change caused by this is guaranteed by this test.
* @see https://docs.aws.amazon.com/apigateway/api-reference/link-relation/authorizer-create/#identitySource | ||
* this should be `method.request.header.Authorizer` where `Authorizer` is the header containing the bearer token. | ||
* | ||
* @see https://docs.aws.amazon.com/apigateway/latest/api/API_CreateAuthorizer.html#apigw-CreateAuthorizer-request-identitySource | ||
* @default `IdentitySource.header('Authorization')` |
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 default value setting process has been changed to fit here.
* @see https://docs.aws.amazon.com/apigateway/api-reference/link-relation/authorizer-create/#identitySource | ||
* this should be `method.request.header.Authorizer` where `Authorizer` is the header containing the bearer token. | ||
* | ||
* @see https://docs.aws.amazon.com/apigateway/latest/api/API_CreateAuthorizer.html#apigw-CreateAuthorizer-request-identitySource | ||
* @default `IdentitySource.header('Authorization')` |
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 default value setting process has been changed to fit here.
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.
Looks good to me 👍
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
…ty source in authorizer (aws#28214) Addressed the following points about Authorizer's `identitySource` property. - Reference link is broken. - now: https://docs.aws.amazon.com/apigateway/api-reference/link-relation/authorizer-create/#identitySource - new: https://docs.aws.amazon.com/apigateway/latest/api/API_CreateAuthorizer.html#apigw-CreateAuthorizer-request-identitySource - One explanation was confusing, so I enclosed it in quotes. - now: ```this should be `method.request.header.Authorizer` where Authorizer is the header containing the bearer token.``` - new: ```this should be `method.request.header.Authorizer` where `Authorizer` is the header containing the bearer token.``` - Not using the static method written in the doc to set default values when a prop is not specified. - now: `'method.request.header.Authorization'` - new: `IdentitySource.header('Authorization')` ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Addressed the following points about Authorizer's
identitySource
property.this should be `method.request.header.Authorizer` where Authorizer is the header containing the bearer token.
this should be `method.request.header.Authorizer` where `Authorizer` is the header containing the bearer token.
'method.request.header.Authorization'
IdentitySource.header('Authorization')
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license