Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Library fails on Firefox [REOPEN] #1621 #1704

Merged
merged 2 commits into from Feb 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,5 +1,4 @@
import { DOCUMENT } from '@angular/common';
import { Inject, Injectable } from '@angular/core';
import { Injectable } from '@angular/core';
import { base64url } from 'rfc4648';
import { from, Observable, of } from 'rxjs';
import { map, mergeMap, tap } from 'rxjs/operators';
Expand Down Expand Up @@ -66,8 +65,7 @@ export class TokenValidationService {
private readonly loggerService: LoggerService,
private readonly jwkExtractor: JwkExtractor,
private readonly jwkWindowCryptoService: JwkWindowCryptoService,
private readonly jwtWindowCryptoService: JwtWindowCryptoService,
@Inject(DOCUMENT) private readonly document: Document
private readonly jwtWindowCryptoService: JwtWindowCryptoService
) {}

// id_token C7: The current time MUST be before the time represented by the exp Claim
Expand Down Expand Up @@ -370,12 +368,6 @@ export class TokenValidationService {
const signingInput = this.tokenHelperService.getSigningInputFromToken(idToken, true, configuration);
const rawSignature = this.tokenHelperService.getSignatureFromToken(idToken, true, configuration);

const agent: string = this.document.defaultView.navigator.userAgent.toLowerCase();

if (agent.indexOf('firefox') > -1 && key.kty === 'EC') {
key.alg = '';
}

return from(this.jwkWindowCryptoService.importVerificationKey(key, algorithm)).pipe(
mergeMap((cryptoKey: CryptoKey) => {
const signature: Uint8Array = base64url.parse(rawSignature, { loose: true });
Expand Down