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 yuth committed Oct 2, 2020
1 parent 0468439 commit 2edd7b4
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 2edd7b4

Please sign in to comment.