Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getValue(): string {
return this.token.id_token;
}
}
@Injectable()
export class AzureADB2CAuthStrategy extends NbOAuth2AuthStrategy {
// we need this method for strategy setup
static setup(options: NbOAuth2AuthStrategyOptions): [NbAuthStrategyClass, NbOAuth2AuthStrategyOptions] {
return [AzureADB2CAuthStrategy, options];
}
protected redirectResultHandlers = {
[NbOAuth2ResponseType.CODE]: () => {
return of(this.route.snapshot.queryParams).pipe(
switchMap((params: any) => {
if (params.code) {
return this.requestToken(params.code);
}
return of(
new NbAuthResult(
false,
params,
this.getOption('redirect.failure'),
this.getOption('defaultErrors'),
[],
));
}),
);
}
return of(
new NbAuthResult(
false,
err,
this.getOption('redirect.failure'),
errors,
));
}),
);
},
};
protected redirectResults: any = {
[NbOAuth2ResponseType.CODE]: () => of(null),
id_token: () => {
return of(this.route.snapshot.fragment).pipe(
map(fragment => this.parseHashAsQueryParams(fragment)),
map((params: any) => !!(params && (params.id_token || params.error))),
);
},
};
}