Skip to content

Commit

Permalink
path
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra committed Nov 19, 2024
1 parent b534bbd commit 138bca2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Get current package version
id: get_version
run: echo "CURRENT_PACKAGE_VERSION=$(node -p "require('./packages/core/package.json').version")" >> $GITHUB_ENV
run: echo "CURRENT_PACKAGE_VERSION=$(node -p "require('./packages/oid4vci/package.json').version")" >> $GITHUB_ENV

- name: Create Github Release
if: steps.changesets.outputs.published == 'true'
Expand Down
12 changes: 6 additions & 6 deletions packages/oauth2/src/common/jwt/verify-jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,26 +96,26 @@ export async function verifyJwt(options: VerifyJwtOptions) {
const timeBasedValidation = options.skipTimeBasedValidation !== undefined ? !options.skipTimeBasedValidation : true

if (timeBasedValidation && options.payload.nbf && nowInSeconds < options.payload.nbf - skewInSeconds) {
throw new Oauth2JwtVerificationError(`${errorMessage}. jwt 'nbf' is in the future`)
throw new Oauth2JwtVerificationError(`${errorMessage} jwt 'nbf' is in the future`)
}

if (timeBasedValidation && options.payload.exp && nowInSeconds > options.payload.exp + skewInSeconds) {
throw new Oauth2JwtVerificationError(`${errorMessage}. jwt 'exp' is in the past`)
throw new Oauth2JwtVerificationError(`${errorMessage} jwt 'exp' is in the past`)
}

if (options.expectedAudience && options.expectedAudience !== options.payload.aud) {
throw new Oauth2JwtVerificationError(`${errorMessage}. jwt 'aud' does not match expected value.`)
throw new Oauth2JwtVerificationError(`${errorMessage} jwt 'aud' does not match expected value.`)
}

if (options.expectedIssuer && options.expectedIssuer !== options.payload.iss) {
throw new Oauth2JwtVerificationError(`${errorMessage}. jwt 'iss' does not match expected value.`)
throw new Oauth2JwtVerificationError(`${errorMessage} jwt 'iss' does not match expected value.`)
}

if (options.expectedNonce && options.expectedNonce !== options.payload.nonce) {
throw new Oauth2JwtVerificationError(`${errorMessage}. jwt 'nonce' does not match expected value.`)
throw new Oauth2JwtVerificationError(`${errorMessage} jwt 'nonce' does not match expected value.`)
}

if (options.expectedSubject && options.expectedSubject !== options.payload.sub) {
throw new Oauth2JwtVerificationError(`${errorMessage}. jwt 'sub' does not match expected value.`)
throw new Oauth2JwtVerificationError(`${errorMessage} jwt 'sub' does not match expected value.`)
}
}

0 comments on commit 138bca2

Please sign in to comment.