Skip to content

Commit a301657

Browse files
committed
2 parents adfe477 + c956df4 commit a301657

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

docs/site/angular-auth-oidc-client/docs/documentation/02-configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ In multi-configuration use-cases, each configuration must be assigned a unique `
182182
- Type: `string`
183183
- Required: `true`
184184

185-
This is the `redirect_url` which was configured on the security token service (STS) server.
185+
This is the url to the Security Token Service (STS). The authority issues tokens.
186186

187187
### `authWellknownEndpointUrl`
188188

projects/angular-auth-oidc-client/src/lib/auth-state/auth-state.service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ describe('Auth State Service', () => {
367367

368368
authStateService.hasIdTokenExpiredAndRenewCheckIsEnabled(config);
369369

370-
expect(spy).toHaveBeenCalledOnceWith('idToken', config, 30);
370+
expect(spy).toHaveBeenCalledOnceWith('idToken', config, 30, undefined);
371371
});
372372

373373
it('fires event if idToken is expired', () => {

projects/angular-auth-oidc-client/src/lib/auth-state/auth-state.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,14 @@ export class AuthStateService {
118118
}
119119

120120
hasIdTokenExpiredAndRenewCheckIsEnabled(configuration: OpenIdConfiguration): boolean {
121-
const { renewTimeBeforeTokenExpiresInSeconds, enableIdTokenExpiredValidationInRenew } = configuration;
121+
const { renewTimeBeforeTokenExpiresInSeconds, enableIdTokenExpiredValidationInRenew, disableIdTokenValidation } = configuration;
122122

123123
if (!enableIdTokenExpiredValidationInRenew) {
124124
return false;
125125
}
126126
const tokenToCheck = this.storagePersistenceService.getIdToken(configuration);
127127

128-
const idTokenExpired = this.tokenValidationService.hasIdTokenExpired(tokenToCheck, configuration, renewTimeBeforeTokenExpiresInSeconds);
128+
const idTokenExpired = this.tokenValidationService.hasIdTokenExpired(tokenToCheck, configuration, renewTimeBeforeTokenExpiresInSeconds, disableIdTokenValidation);
129129

130130
if (idTokenExpired) {
131131
this.publicEventsService.fireEvent<boolean>(EventTypes.IdTokenExpired, idTokenExpired);

projects/angular-auth-oidc-client/src/lib/config/openid-configuration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,6 @@ export interface OpenIdConfiguration {
175175
* The refresh token rotation is optional (rfc6749) but is more safe and hence encouraged.
176176
*/
177177
allowUnsafeReuseRefreshToken?: boolean;
178+
/** Disable validation for id_token expiry time */
179+
disableIdTokenValidation?: boolean
178180
}

projects/angular-auth-oidc-client/src/lib/validation/state-validation.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class StateValidationService {
5151
}
5252

5353
if (callbackContext.authResult.id_token) {
54-
const { clientId, issValidationOff, maxIdTokenIatOffsetAllowedInSeconds, disableIatOffsetValidation, ignoreNonceAfterRefresh } =
54+
const { clientId, issValidationOff, maxIdTokenIatOffsetAllowedInSeconds, disableIatOffsetValidation, ignoreNonceAfterRefresh, disableIdTokenValidation } =
5555
configuration;
5656

5757
toReturn.idToken = callbackContext.authResult.id_token;
@@ -164,7 +164,7 @@ export class StateValidationService {
164164
return of(toReturn);
165165
}
166166

167-
if (!this.tokenValidationService.validateIdTokenExpNotExpired(toReturn.decodedIdToken, configuration)) {
167+
if (!this.tokenValidationService.validateIdTokenExpNotExpired(toReturn.decodedIdToken, configuration, maxIdTokenIatOffsetAllowedInSeconds, disableIdTokenValidation)) {
168168
this.loggerService.logWarning(configuration, 'authCallback id token expired');
169169
toReturn.state = ValidationResult.TokenExpired;
170170
this.handleUnsuccessfulValidation(configuration);

projects/angular-auth-oidc-client/src/lib/validation/token-validation.service.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,17 @@ export class TokenValidationService {
6868

6969
// id_token C7: The current time MUST be before the time represented by the exp Claim
7070
// (possibly allowing for some small leeway to account for clock skew).
71-
hasIdTokenExpired(token: string, configuration: OpenIdConfiguration, offsetSeconds?: number): boolean {
71+
hasIdTokenExpired(token: string, configuration: OpenIdConfiguration, offsetSeconds?: number, disableIdTokenValidation?: boolean): boolean {
7272
const decoded = this.tokenHelperService.getPayloadFromToken(token, false, configuration);
7373

74-
return !this.validateIdTokenExpNotExpired(decoded, configuration, offsetSeconds);
74+
return !this.validateIdTokenExpNotExpired(decoded, configuration, offsetSeconds, disableIdTokenValidation);
7575
}
7676

7777
// id_token C7: The current time MUST be before the time represented by the exp Claim
7878
// (possibly allowing for some small leeway to account for clock skew).
79-
validateIdTokenExpNotExpired(decodedIdToken: string, configuration: OpenIdConfiguration, offsetSeconds?: number): boolean {
79+
validateIdTokenExpNotExpired(decodedIdToken: string, configuration: OpenIdConfiguration, offsetSeconds?: number, disableIdTokenValidation?: boolean): boolean {
80+
if (disableIdTokenValidation) return true;
81+
8082
const tokenExpirationDate = this.tokenHelperService.getTokenExpirationDate(decodedIdToken);
8183
offsetSeconds = offsetSeconds || 0;
8284

0 commit comments

Comments
 (0)