Skip to content

Commit e231560

Browse files
authored
Eliminate duplicate BLACKLISTED_CLAIMS (#709)
Requires exposing this constant so that the tests can use it.
1 parent 01a01a9 commit e231560

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/auth/token-generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const ALGORITHM_RS256 = 'RS256';
2727
const ONE_HOUR_IN_SECONDS = 60 * 60;
2828

2929
// List of blacklisted claims which cannot be provided when creating a custom token
30-
const BLACKLISTED_CLAIMS = [
30+
export const BLACKLISTED_CLAIMS = [
3131
'acr', 'amr', 'at_hash', 'aud', 'auth_time', 'azp', 'cnf', 'c_hash', 'exp', 'iat', 'iss', 'jti',
3232
'nbf', 'nonce',
3333
];

test/unit/auth/token-generator.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ import * as sinonChai from 'sinon-chai';
2424
import * as chaiAsPromised from 'chai-as-promised';
2525

2626
import * as mocks from '../../resources/mocks';
27-
import {FirebaseTokenGenerator, ServiceAccountSigner, IAMSigner} from '../../../src/auth/token-generator';
27+
import {
28+
BLACKLISTED_CLAIMS, FirebaseTokenGenerator, ServiceAccountSigner, IAMSigner,
29+
} from '../../../src/auth/token-generator';
2830

2931
import {Certificate} from '../../../src/auth/credential';
3032
import { AuthorizedHttpClient, HttpClient } from '../../../src/utils/api-request';
@@ -40,10 +42,6 @@ const expect = chai.expect;
4042
const ALGORITHM = 'RS256';
4143
const ONE_HOUR_IN_SECONDS = 60 * 60;
4244
const FIREBASE_AUDIENCE = 'https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit';
43-
const BLACKLISTED_CLAIMS = [
44-
'acr', 'amr', 'at_hash', 'aud', 'auth_time', 'azp', 'cnf', 'c_hash', 'exp', 'iat', 'iss', 'jti',
45-
'nbf', 'nonce',
46-
];
4745

4846
/**
4947
* Verifies a token is signed with the private key corresponding to the provided public key.

0 commit comments

Comments
 (0)