Skip to content

Commit

Permalink
fix: aws-amplify#5372 - cut signing url ending slash when matching in…
Browse files Browse the repository at this point in the history
… mock (aws-amplify#5434)
  • Loading branch information
Attila Hajdrik authored and Ross Ragsdale committed Nov 19, 2020
1 parent b5d97b1 commit 548fd8d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export function extractJwtToken(authorization: string): JWTToken {
export function isValidOIDCToken(token: JWTToken, configuredAuthTypes: AmplifyAppSyncAuthenticationProviderConfig[]): boolean {
const oidcIssuers = configuredAuthTypes
.filter(authType => authType.authenticationType === AmplifyAppSyncSimulatorAuthenticationType.OPENID_CONNECT)
.map((auth: AmplifyAppSyncAuthenticationProviderOIDCConfig) => auth.openIDConnectConfig.Issuer);
.map((auth: AmplifyAppSyncAuthenticationProviderOIDCConfig) =>
auth.openIDConnectConfig.Issuer && auth.openIDConnectConfig.Issuer.endsWith('/')
? auth.openIDConnectConfig.Issuer.substring(0, auth.openIDConnectConfig.Issuer.length - 1)
: auth.openIDConnectConfig.Issuer,
);

return oidcIssuers.length > 0 && oidcIssuers.includes(token.iss);
}
Expand Down

0 comments on commit 548fd8d

Please sign in to comment.