@auth0/auth0-angular 1.11.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/{esm2015/auth0-auth0-angular.js → esm2020/auth0-auth0-angular.mjs} +0 -0
- package/{esm2015/lib/abstract-navigator.js → esm2020/lib/abstract-navigator.mjs} +6 -5
- package/esm2020/lib/auth.client.mjs +23 -0
- package/esm2020/lib/auth.config.mjs +97 -0
- package/{esm2015/lib/auth.guard.js → esm2020/lib/auth.guard.mjs} +3 -3
- package/esm2020/lib/auth.interceptor.mjs +134 -0
- package/esm2020/lib/auth.module.mjs +39 -0
- package/esm2020/lib/auth.service.mjs +229 -0
- package/esm2020/lib/auth.state.mjs +100 -0
- package/esm2020/lib/interfaces.mjs +2 -0
- package/esm2020/public-api.mjs +13 -0
- package/{esm2015/useragent.js → esm2020/useragent.mjs} +2 -2
- package/fesm2015/auth0-auth0-angular.mjs +678 -0
- package/fesm2015/auth0-auth0-angular.mjs.map +1 -0
- package/{fesm2015/auth0-auth0-angular.js → fesm2020/auth0-auth0-angular.mjs} +80 -135
- package/fesm2020/auth0-auth0-angular.mjs.map +1 -0
- package/lib/abstract-navigator.d.ts +1 -0
- package/lib/auth.config.d.ts +4 -134
- package/lib/auth.interceptor.d.ts +7 -1
- package/lib/auth.module.d.ts +1 -0
- package/lib/auth.service.d.ts +8 -67
- package/lib/auth.state.d.ts +3 -0
- package/lib/interfaces.d.ts +5 -0
- package/package.json +23 -10
- package/public-api.d.ts +1 -0
- package/bundles/auth0-auth0-angular.umd.js +0 -1148
- package/bundles/auth0-auth0-angular.umd.js.map +0 -1
- package/esm2015/lib/auth.client.js +0 -22
- package/esm2015/lib/auth.config.js +0 -95
- package/esm2015/lib/auth.interceptor.js +0 -129
- package/esm2015/lib/auth.module.js +0 -38
- package/esm2015/lib/auth.service.js +0 -294
- package/esm2015/lib/auth.state.js +0 -99
- package/esm2015/public-api.js +0 -12
- package/fesm2015/auth0-auth0-angular.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth0-auth0-angular.mjs","sources":["../../../projects/auth0-angular/src/useragent.ts","../../../projects/auth0-angular/src/lib/auth.client.ts","../../../projects/auth0-angular/src/lib/auth.config.ts","../../../projects/auth0-angular/src/lib/abstract-navigator.ts","../../../projects/auth0-angular/src/lib/auth.state.ts","../../../projects/auth0-angular/src/lib/auth.service.ts","../../../projects/auth0-angular/src/lib/auth.guard.ts","../../../projects/auth0-angular/src/lib/auth.module.ts","../../../projects/auth0-angular/src/lib/auth.interceptor.ts","../../../projects/auth0-angular/src/public-api.ts","../../../projects/auth0-angular/src/auth0-auth0-angular.ts"],"sourcesContent":["export default { name: '@auth0/auth0-angular', version: '2.0.0' };\n","import { InjectionToken, VERSION } from '@angular/core';\nimport { Auth0Client } from '@auth0/auth0-spa-js';\nimport { AuthClientConfig } from './auth.config';\nimport useragent from '../useragent';\n\nexport class Auth0ClientFactory {\n static createClient(configFactory: AuthClientConfig): Auth0Client {\n const config = configFactory.get();\n\n if (!config) {\n throw new Error(\n 'Configuration must be specified either through AuthModule.forRoot or through AuthClientConfig.set'\n );\n }\n\n return new Auth0Client({\n ...config,\n auth0Client: {\n name: useragent.name,\n version: useragent.version,\n env: {\n 'angular/core': VERSION.full,\n },\n },\n });\n }\n}\n\nexport const Auth0ClientService = new InjectionToken<Auth0Client>(\n 'auth0.client'\n);\n","import {\n Auth0ClientOptions,\n CacheLocation,\n GetTokenSilentlyOptions,\n ICache,\n} from '@auth0/auth0-spa-js';\n\nimport { InjectionToken, Injectable, Optional, Inject } from '@angular/core';\n\n/**\n * Defines a common set of HTTP methods.\n */\nexport const enum HttpMethod {\n Get = 'GET',\n Post = 'POST',\n Put = 'PUT',\n Patch = 'PATCH',\n Delete = 'DELETE',\n Head = 'HEAD',\n}\n\n/**\n * Defines the type for a route config entry. Can either be:\n *\n * - an object of type HttpInterceptorRouteConfig\n * - a string\n */\nexport type ApiRouteDefinition = HttpInterceptorRouteConfig | string;\n\n/**\n * A custom type guard to help identify route definitions that are actually HttpInterceptorRouteConfig types.\n *\n * @param def The route definition type\n */\nexport function isHttpInterceptorRouteConfig(\n def: ApiRouteDefinition\n): def is HttpInterceptorRouteConfig {\n return typeof def !== 'string';\n}\n\n/**\n * Configuration for the HttpInterceptor\n */\nexport interface HttpInterceptorConfig {\n allowedList: ApiRouteDefinition[];\n}\n\n/**\n * Configuration for a single interceptor route\n */\nexport interface HttpInterceptorRouteConfig {\n /**\n * The URL to test, by supplying the URL to match.\n * If `test` is a match for the current request path from the HTTP client, then\n * an access token is attached to the request in the\n * [\"Authorization\" header](https://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-20#section-2.1).\n *\n * If the test does not pass, the request proceeds without the access token attached.\n *\n * A wildcard character can be used to match only the start of the URL.\n *\n * @usagenotes\n *\n * '/api' - exactly match the route /api\n * '/api/*' - match any route that starts with /api/\n */\n uri?: string;\n\n /**\n * A function that will be called with the HttpRequest.url value, allowing you to do\n * any kind of flexible matching.\n *\n * If this function returns true, then\n * an access token is attached to the request in the\n * [\"Authorization\" header](https://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-20#section-2.1).\n *\n * If it returns false, the request proceeds without the access token attached.\n */\n uriMatcher?: (uri: string) => boolean;\n\n /**\n * The options that are passed to the SDK when retrieving the\n * access token to attach to the outgoing request.\n */\n tokenOptions?: GetTokenSilentlyOptions;\n\n /**\n * The HTTP method to match on. If specified, the HTTP method of\n * the outgoing request will be checked against this. If there is no match, the\n * Authorization header is not attached.\n *\n * The HTTP method name is case-sensitive.\n */\n httpMethod?: HttpMethod | string;\n\n /**\n * Allow the HTTP call to be executed anonymously, when no token is available.\n *\n * When omitted (or set to false), calls that match the configuration will fail when no token is available.\n */\n allowAnonymous?: boolean;\n}\n\n/**\n * Configuration for the authentication service\n */\nexport interface AuthConfig extends Auth0ClientOptions {\n /**\n * By default, if the page URL has code and state parameters, the SDK will assume they are for\n * an Auth0 application and attempt to exchange the code for a token.\n * In some cases the code might be for something else (e.g. another OAuth SDK). In these\n * instances you can instruct the client to ignore them by setting `skipRedirectCallback`.\n *\n * ```js\n * AuthModule.forRoot({\n * skipRedirectCallback: window.location.pathname === '/other-callback'\n * })\n * ```\n *\n * **Note**: In the above example, `/other-callback` is an existing route that will be called\n * by any other OAuth provider with a `code` (or `error` in case when something went wrong) and `state`.\n *\n */\n skipRedirectCallback?: boolean;\n\n /**\n * Configuration for the built-in Http Interceptor, used for\n * automatically attaching access tokens.\n */\n httpInterceptor?: HttpInterceptorConfig;\n\n /**\n * Path in your application to redirect to when the Authorization server\n * returns an error. Defaults to `/`\n */\n errorPath?: string;\n}\n\n/**\n * Angular specific state to be stored before redirect\n */\nexport interface AppState {\n /**\n * Target path the app gets routed to after\n * handling the callback from Auth0 (defaults to '/')\n */\n target?: string;\n\n /**\n * Any custom parameter to be stored in appState\n */\n [key: string]: any;\n}\n\n/**\n * Gets and sets configuration for the internal Auth0 client. This can be\n * used to provide configuration outside of using AuthModule.forRoot, i.e. from\n * a factory provided by APP_INITIALIZER.\n *\n * @usage\n *\n * ```js\n * // app.module.ts\n * // ---------------------------\n * import { AuthModule, AuthClientConfig } from '@auth0/auth0-angular';\n *\n * // Provide an initializer function that returns a Promise\n * function configInitializer(\n * http: HttpClient,\n * config: AuthClientConfig\n * ) {\n * return () =>\n * http\n * .get('/config')\n * .toPromise()\n * .then((loadedConfig: any) => config.set(loadedConfig)); // Set the config that was loaded asynchronously here\n * }\n *\n * // Provide APP_INITIALIZER with this function. Note that there is no config passed to AuthModule.forRoot\n * imports: [\n * // other imports..\n *\n * HttpClientModule,\n * AuthModule.forRoot(), //<- don't pass any config here\n * ],\n * providers: [\n * {\n * provide: APP_INITIALIZER,\n * useFactory: configInitializer, // <- pass your initializer function here\n * deps: [HttpClient, AuthClientConfig],\n * multi: true,\n * },\n * ],\n * ```\n *\n */\n@Injectable({ providedIn: 'root' })\nexport class AuthClientConfig {\n private config?: AuthConfig;\n\n constructor(@Optional() @Inject(AuthConfigService) config?: AuthConfig) {\n if (config) {\n this.set(config);\n }\n }\n\n /**\n * Sets configuration to be read by other consumers of the service (see usage notes)\n *\n * @param config The configuration to set\n */\n set(config: AuthConfig): void {\n this.config = config;\n }\n\n /**\n * Gets the config that has been set by other consumers of the service\n */\n get(): AuthConfig {\n return this.config as AuthConfig;\n }\n}\n\n/**\n * Injection token for accessing configuration.\n *\n * @usageNotes\n *\n * Use the `Inject` decorator to access the configuration from a service or component:\n *\n * ```\n * class MyService(@Inject(AuthConfigService) config: AuthConfig) {}\n * ```\n */\nexport const AuthConfigService = new InjectionToken<AuthConfig>(\n 'auth0-angular.config'\n);\n","import { Injectable, Injector } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { Location } from '@angular/common';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AbstractNavigator {\n private readonly router?: Router;\n\n constructor(private location: Location, injector: Injector) {\n try {\n this.router = injector.get(Router);\n } catch {}\n }\n\n /**\n * Navigates to the specified url. The router will be used if one is available, otherwise it falls back\n * to `window.history.replaceState`.\n *\n * @param url The url to navigate to\n */\n navigateByUrl(url: string): void {\n if (this.router) {\n this.router.navigateByUrl(url);\n\n return;\n }\n\n this.location.replaceState(url);\n }\n}\n","import { Inject, Injectable } from '@angular/core';\nimport { Auth0Client } from '@auth0/auth0-spa-js';\nimport {\n BehaviorSubject,\n defer,\n merge,\n of,\n ReplaySubject,\n Subject,\n} from 'rxjs';\nimport {\n concatMap,\n distinctUntilChanged,\n filter,\n mergeMap,\n scan,\n shareReplay,\n switchMap,\n} from 'rxjs/operators';\nimport { Auth0ClientService } from './auth.client';\n\n/**\n * Tracks the Authentication State for the SDK\n */\n@Injectable({ providedIn: 'root' })\nexport class AuthState {\n private isLoadingSubject$ = new BehaviorSubject<boolean>(true);\n private refresh$ = new Subject<void>();\n private accessToken$ = new ReplaySubject<string>(1);\n private errorSubject$ = new ReplaySubject<Error>(1);\n\n /**\n * Emits boolean values indicating the loading state of the SDK.\n */\n public readonly isLoading$ = this.isLoadingSubject$.asObservable();\n\n /**\n * Trigger used to pull User information from the Auth0Client.\n * Triggers when the access token has changed.\n */\n private accessTokenTrigger$ = this.accessToken$.pipe(\n scan(\n (\n acc: { current: string | null; previous: string | null },\n current: string | null\n ) => ({\n previous: acc.current,\n current,\n }),\n { current: null, previous: null }\n ),\n filter(({ previous, current }) => previous !== current)\n );\n\n /**\n * Trigger used to pull User information from the Auth0Client.\n * Triggers when an event occurs that needs to retrigger the User Profile information.\n * Events: Login, Access Token change and Logout\n */\n private readonly isAuthenticatedTrigger$ = this.isLoading$.pipe(\n filter((loading) => !loading),\n distinctUntilChanged(),\n switchMap(() =>\n // To track the value of isAuthenticated over time, we need to merge:\n // - the current value\n // - the value whenever the access token changes. (this should always be true of there is an access token\n // but it is safer to pass this through this.auth0Client.isAuthenticated() nevertheless)\n // - the value whenever refreshState$ emits\n merge(\n defer(() => this.auth0Client.isAuthenticated()),\n this.accessTokenTrigger$.pipe(\n mergeMap(() => this.auth0Client.isAuthenticated())\n ),\n this.refresh$.pipe(mergeMap(() => this.auth0Client.isAuthenticated()))\n )\n )\n );\n\n /**\n * Emits boolean values indicating the authentication state of the user. If `true`, it means a user has authenticated.\n * This depends on the value of `isLoading$`, so there is no need to manually check the loading state of the SDK.\n */\n readonly isAuthenticated$ = this.isAuthenticatedTrigger$.pipe(\n distinctUntilChanged(),\n shareReplay(1)\n );\n\n /**\n * Emits details about the authenticated user, or null if not authenticated.\n */\n readonly user$ = this.isAuthenticatedTrigger$.pipe(\n concatMap((authenticated) =>\n authenticated ? this.auth0Client.getUser() : of(null)\n ),\n distinctUntilChanged()\n );\n\n /**\n * Emits ID token claims when authenticated, or null if not authenticated.\n */\n readonly idTokenClaims$ = this.isAuthenticatedTrigger$.pipe(\n concatMap((authenticated) =>\n authenticated ? this.auth0Client.getIdTokenClaims() : of(null)\n )\n );\n\n /**\n * Emits errors that occur during login, or when checking for an active session on startup.\n */\n public readonly error$ = this.errorSubject$.asObservable();\n\n constructor(@Inject(Auth0ClientService) private auth0Client: Auth0Client) {}\n\n /**\n * Update the isLoading state using the provided value\n *\n * @param isLoading The new value for isLoading\n */\n public setIsLoading(isLoading: boolean): void {\n this.isLoadingSubject$.next(isLoading);\n }\n\n /**\n * Refresh the state to ensure the `isAuthenticated`, `user$` and `idTokenClaims$`\n * reflect the most up-to-date values from Auth0Client.\n */\n public refresh(): void {\n this.refresh$.next();\n }\n\n /**\n * Update the access token, doing so will also refresh the state.\n *\n * @param accessToken The new Access Token\n */\n public setAccessToken(accessToken: string): void {\n this.accessToken$.next(accessToken);\n }\n\n /**\n * Emits the error in the `error$` observable.\n *\n * @param error The new error\n */\n public setError(error: any): void {\n this.errorSubject$.next(error);\n }\n}\n","import { Injectable, Inject, OnDestroy } from '@angular/core';\n\nimport {\n Auth0Client,\n PopupLoginOptions,\n PopupConfigOptions,\n GetTokenSilentlyOptions,\n GetTokenWithPopupOptions,\n RedirectLoginResult,\n GetTokenSilentlyVerboseResponse,\n} from '@auth0/auth0-spa-js';\n\nimport {\n of,\n from,\n Subject,\n Observable,\n iif,\n defer,\n ReplaySubject,\n throwError,\n} from 'rxjs';\n\nimport {\n concatMap,\n tap,\n map,\n takeUntil,\n catchError,\n switchMap,\n withLatestFrom,\n} from 'rxjs/operators';\n\nimport { Auth0ClientService } from './auth.client';\nimport { AbstractNavigator } from './abstract-navigator';\nimport { AuthClientConfig, AppState } from './auth.config';\nimport { AuthState } from './auth.state';\nimport { LogoutOptions, RedirectLoginOptions } from './interfaces';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthService<TAppState extends AppState = AppState>\n implements OnDestroy {\n private appStateSubject$ = new ReplaySubject<TAppState>(1);\n\n // https://stackoverflow.com/a/41177163\n private ngUnsubscribe$ = new Subject<void>();\n /**\n * Emits boolean values indicating the loading state of the SDK.\n */\n readonly isLoading$ = this.authState.isLoading$;\n\n /**\n * Emits boolean values indicating the authentication state of the user. If `true`, it means a user has authenticated.\n * This depends on the value of `isLoading$`, so there is no need to manually check the loading state of the SDK.\n */\n readonly isAuthenticated$ = this.authState.isAuthenticated$;\n\n /**\n * Emits details about the authenticated user, or null if not authenticated.\n */\n readonly user$ = this.authState.user$;\n\n /**\n * Emits ID token claims when authenticated, or null if not authenticated.\n */\n readonly idTokenClaims$ = this.authState.idTokenClaims$;\n\n /**\n * Emits errors that occur during login, or when checking for an active session on startup.\n */\n readonly error$ = this.authState.error$;\n\n /**\n * Emits the value (if any) that was passed to the `loginWithRedirect` method call\n * but only **after** `handleRedirectCallback` is first called\n */\n readonly appState$ = this.appStateSubject$.asObservable();\n\n constructor(\n @Inject(Auth0ClientService) private auth0Client: Auth0Client,\n private configFactory: AuthClientConfig,\n private navigator: AbstractNavigator,\n private authState: AuthState\n ) {\n const checkSessionOrCallback$ = (isCallback: boolean) =>\n iif(\n () => isCallback,\n this.handleRedirectCallback(),\n defer(() => this.auth0Client.checkSession())\n );\n\n this.shouldHandleCallback()\n .pipe(\n switchMap((isCallback) =>\n checkSessionOrCallback$(isCallback).pipe(\n catchError((error) => {\n const config = this.configFactory.get();\n this.navigator.navigateByUrl(config.errorPath || '/');\n this.authState.setError(error);\n return of(undefined);\n })\n )\n ),\n tap(() => {\n this.authState.setIsLoading(false);\n }),\n takeUntil(this.ngUnsubscribe$)\n )\n .subscribe();\n }\n\n /**\n * Called when the service is destroyed\n */\n ngOnDestroy(): void {\n // https://stackoverflow.com/a/41177163\n this.ngUnsubscribe$.next();\n this.ngUnsubscribe$.complete();\n }\n\n /**\n * ```js\n * loginWithRedirect(options);\n * ```\n *\n * Performs a redirect to `/authorize` using the parameters\n * provided as arguments. Random and secure `state` and `nonce`\n * parameters will be auto-generated.\n *\n * @param options The login options\n */\n loginWithRedirect(\n options?: RedirectLoginOptions<TAppState>\n ): Observable<void> {\n return from(this.auth0Client.loginWithRedirect(options));\n }\n\n /**\n * ```js\n * await loginWithPopup(options);\n * ```\n *\n * Opens a popup with the `/authorize` URL using the parameters\n * provided as arguments. Random and secure `state` and `nonce`\n * parameters will be auto-generated. If the response is successful,\n * results will be valid according to their expiration times.\n *\n * IMPORTANT: This method has to be called from an event handler\n * that was started by the user like a button click, for example,\n * otherwise the popup will be blocked in most browsers.\n *\n * @param options The login options\n * @param config Configuration for the popup window\n */\n loginWithPopup(\n options?: PopupLoginOptions,\n config?: PopupConfigOptions\n ): Observable<void> {\n return from(\n this.auth0Client.loginWithPopup(options, config).then(() => {\n this.authState.refresh();\n })\n );\n }\n\n /**\n * ```js\n * logout();\n * ```\n *\n * Clears the application session and performs a redirect to `/v2/logout`, using\n * the parameters provided as arguments, to clear the Auth0 session.\n * If the `federated` option is specified it also clears the Identity Provider session.\n * If the `openUrl` option is set to false, it only clears the application session.\n * It is invalid to set both the `federated` to true and `openUrl` to `false`,\n * and an error will be thrown if you do.\n * [Read more about how Logout works at Auth0](https://auth0.com/docs/logout).\n *\n * @param options The logout options\n */\n logout(options?: LogoutOptions): Observable<void> {\n return from(\n this.auth0Client.logout(options).then(() => {\n if (options?.openUrl === false || options?.openUrl) {\n this.authState.refresh();\n }\n })\n );\n }\n\n /**\n * Fetches a new access token and returns the response from the /oauth/token endpoint, omitting the refresh token.\n *\n * @param options The options for configuring the token fetch.\n */\n getAccessTokenSilently(\n options: GetTokenSilentlyOptions & { detailedResponse: true }\n ): Observable<GetTokenSilentlyVerboseResponse>;\n\n /**\n * Fetches a new access token and returns it.\n *\n * @param options The options for configuring the token fetch.\n */\n getAccessTokenSilently(options?: GetTokenSilentlyOptions): Observable<string>;\n\n /**\n * ```js\n * getAccessTokenSilently(options).subscribe(token => ...)\n * ```\n *\n * If there's a valid token stored, return it. Otherwise, opens an\n * iframe with the `/authorize` URL using the parameters provided\n * as arguments. Random and secure `state` and `nonce` parameters\n * will be auto-generated. If the response is successful, results\n * will be valid according to their expiration times.\n *\n * If refresh tokens are used, the token endpoint is called directly with the\n * 'refresh_token' grant. If no refresh token is available to make this call,\n * the SDK falls back to using an iframe to the '/authorize' URL.\n *\n * This method may use a web worker to perform the token call if the in-memory\n * cache is used.\n *\n * If an `audience` value is given to this function, the SDK always falls\n * back to using an iframe to make the token exchange.\n *\n * Note that in all cases, falling back to an iframe requires access to\n * the `auth0` cookie, and thus will not work in browsers that block third-party\n * cookies by default (Safari, Brave, etc).\n *\n * @param options The options for configuring the token fetch.\n */\n getAccessTokenSilently(\n options: GetTokenSilentlyOptions = {}\n ): Observable<string | GetTokenSilentlyVerboseResponse> {\n return of(this.auth0Client).pipe(\n concatMap((client) =>\n options.detailedResponse === true\n ? client.getTokenSilently({ ...options, detailedResponse: true })\n : client.getTokenSilently(options)\n ),\n tap((token) =>\n this.authState.setAccessToken(\n typeof token === 'string' ? token : token.access_token\n )\n ),\n catchError((error) => {\n this.authState.setError(error);\n this.authState.refresh();\n return throwError(error);\n })\n );\n }\n\n /**\n * ```js\n * getTokenWithPopup(options).subscribe(token => ...)\n * ```\n *\n * Get an access token interactively.\n *\n * Opens a popup with the `/authorize` URL using the parameters\n * provided as arguments. Random and secure `state` and `nonce`\n * parameters will be auto-generated. If the response is successful,\n * results will be valid according to their expiration times.\n */\n getAccessTokenWithPopup(\n options?: GetTokenWithPopupOptions\n ): Observable<string | undefined> {\n return of(this.auth0Client).pipe(\n concatMap((client) => client.getTokenWithPopup(options)),\n tap((token) => {\n if (token) {\n this.authState.setAccessToken(token);\n }\n }),\n catchError((error) => {\n this.authState.setError(error);\n this.authState.refresh();\n return throwError(error);\n })\n );\n }\n\n /**\n * ```js\n * handleRedirectCallback(url).subscribe(result => ...)\n * ```\n *\n * After the browser redirects back to the callback page,\n * call `handleRedirectCallback` to handle success and error\n * responses from Auth0. If the response is successful, results\n * will be valid according to their expiration times.\n *\n * Calling this method also refreshes the authentication and user states.\n *\n * @param url The URL to that should be used to retrieve the `state` and `code` values. Defaults to `window.location.href` if not given.\n */\n handleRedirectCallback(\n url?: string\n ): Observable<RedirectLoginResult<TAppState>> {\n return defer(() =>\n this.auth0Client.handleRedirectCallback<TAppState>(url)\n ).pipe(\n withLatestFrom(this.authState.isLoading$),\n tap(([result, isLoading]) => {\n if (!isLoading) {\n this.authState.refresh();\n }\n const appState = result?.appState;\n const target = appState?.target ?? '/';\n\n if (appState) {\n this.appStateSubject$.next(appState);\n }\n\n this.navigator.navigateByUrl(target);\n }),\n map(([result]) => result)\n );\n }\n\n private shouldHandleCallback(): Observable<boolean> {\n return of(location.search).pipe(\n map((search) => {\n const searchParams = new URLSearchParams(search);\n return (\n (searchParams.has('code') || searchParams.has('error')) &&\n searchParams.has('state') &&\n !this.configFactory.get().skipRedirectCallback\n );\n })\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n RouterStateSnapshot,\n CanActivate,\n CanLoad,\n Route,\n UrlSegment,\n CanActivateChild,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport { tap, take } from 'rxjs/operators';\nimport { AuthService } from './auth.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthGuard implements CanActivate, CanLoad, CanActivateChild {\n constructor(private auth: AuthService) {}\n\n canLoad(route: Route, segments: UrlSegment[]): Observable<boolean> {\n return this.auth.isAuthenticated$.pipe(take(1));\n }\n\n canActivate(\n next: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Observable<boolean> {\n return this.redirectIfUnauthenticated(state);\n }\n\n canActivateChild(\n childRoute: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): Observable<boolean> {\n return this.redirectIfUnauthenticated(state);\n }\n\n private redirectIfUnauthenticated(\n state: RouterStateSnapshot\n ): Observable<boolean> {\n return this.auth.isAuthenticated$.pipe(\n tap((loggedIn) => {\n if (!loggedIn) {\n this.auth.loginWithRedirect({\n appState: { target: state.url },\n });\n }\n })\n );\n }\n}\n","import { NgModule, ModuleWithProviders } from '@angular/core';\nimport { AuthService } from './auth.service';\nimport { AuthConfig, AuthConfigService, AuthClientConfig } from './auth.config';\nimport { Auth0ClientService, Auth0ClientFactory } from './auth.client';\nimport { AuthGuard } from './auth.guard';\n\n@NgModule()\nexport class AuthModule {\n /**\n * Initialize the authentication module system. Configuration can either be specified here,\n * or by calling AuthClientConfig.set (perhaps from an APP_INITIALIZER factory function).\n *\n * @param config The optional configuration for the SDK.\n */\n static forRoot(config?: AuthConfig): ModuleWithProviders<AuthModule> {\n return {\n ngModule: AuthModule,\n providers: [\n AuthService,\n AuthGuard,\n {\n provide: AuthConfigService,\n useValue: config,\n },\n {\n provide: Auth0ClientService,\n useFactory: Auth0ClientFactory.createClient,\n deps: [AuthClientConfig],\n },\n ],\n };\n }\n}\n","import {\n HttpInterceptor,\n HttpRequest,\n HttpHandler,\n HttpEvent,\n} from '@angular/common/http';\n\nimport { Observable, from, of, iif, throwError } from 'rxjs';\nimport { Inject, Injectable } from '@angular/core';\n\nimport {\n ApiRouteDefinition,\n isHttpInterceptorRouteConfig,\n AuthClientConfig,\n HttpInterceptorConfig,\n} from './auth.config';\n\nimport {\n switchMap,\n first,\n concatMap,\n catchError,\n tap,\n filter,\n mergeMap,\n mapTo,\n pluck,\n} from 'rxjs/operators';\nimport { Auth0Client, GetTokenSilentlyOptions } from '@auth0/auth0-spa-js';\nimport { Auth0ClientService } from './auth.client';\nimport { AuthState } from './auth.state';\nimport { AuthService } from './auth.service';\n\nconst waitUntil = <TSignal>(signal$: Observable<TSignal>) => <TSource>(\n source$: Observable<TSource>\n) => source$.pipe(mergeMap((value) => signal$.pipe(first(), mapTo(value))));\n\n@Injectable()\nexport class AuthHttpInterceptor implements HttpInterceptor {\n constructor(\n private configFactory: AuthClientConfig,\n @Inject(Auth0ClientService) private auth0Client: Auth0Client,\n private authState: AuthState,\n private authService: AuthService,\n ) {}\n\n intercept(\n req: HttpRequest<any>,\n next: HttpHandler\n ): Observable<HttpEvent<any>> {\n const config = this.configFactory.get();\n if (!config.httpInterceptor?.allowedList) {\n return next.handle(req);\n }\n\n const isLoaded$ = this.authService.isLoading$.pipe(\n filter((isLoading) => !isLoading),\n );\n\n return this.findMatchingRoute(req, config.httpInterceptor).pipe(\n concatMap((route) =>\n iif(\n // Check if a route was matched\n () => route !== null,\n // If we have a matching route, call getTokenSilently and attach the token to the\n // outgoing request\n of(route).pipe(\n waitUntil(isLoaded$),\n pluck('tokenOptions'),\n concatMap<GetTokenSilentlyOptions, Observable<string>>((options) =>\n this.getAccessTokenSilently(options).pipe(\n catchError((err) => {\n if (this.allowAnonymous(route, err)) {\n return of('');\n }\n\n this.authState.setError(err);\n return throwError(err);\n })\n )\n ),\n switchMap((token: string) => {\n // Clone the request and attach the bearer token\n const clone = token\n ? req.clone({\n headers: req.headers.set(\n 'Authorization',\n `Bearer ${token}`\n ),\n })\n : req;\n\n return next.handle(clone);\n })\n ),\n // If the URI being called was not found in our httpInterceptor config, simply\n // pass the request through without attaching a token\n next.handle(req)\n )\n )\n );\n }\n\n /**\n * Duplicate of AuthService.getAccessTokenSilently, but with a slightly different error handling.\n * Only used internally in the interceptor.\n *\n * @param options The options for configuring the token fetch.\n */\n private getAccessTokenSilently(\n options?: GetTokenSilentlyOptions\n ): Observable<string> {\n return of(this.auth0Client).pipe(\n concatMap((client) => client.getTokenSilently(options)),\n tap((token) => this.authState.setAccessToken(token)),\n catchError((error) => {\n this.authState.refresh();\n return throwError(error);\n })\n );\n }\n\n /**\n * Strips the query and fragment from the given uri\n *\n * @param uri The uri to remove the query and fragment from\n */\n private stripQueryFrom(uri: string): string {\n if (uri.indexOf('?') > -1) {\n uri = uri.substr(0, uri.indexOf('?'));\n }\n\n if (uri.indexOf('#') > -1) {\n uri = uri.substr(0, uri.indexOf('#'));\n }\n\n return uri;\n }\n\n /**\n * Determines whether the specified route can have an access token attached to it, based on matching the HTTP request against\n * the interceptor route configuration.\n *\n * @param route The route to test\n * @param request The HTTP request\n */\n private canAttachToken(\n route: ApiRouteDefinition,\n request: HttpRequest<any>\n ): boolean {\n const testPrimitive = (value: string | undefined): boolean => {\n if (!value) {\n return false;\n }\n\n const requestPath = this.stripQueryFrom(request.url);\n\n if (value === requestPath) {\n return true;\n }\n\n // If the URL ends with an asterisk, match using startsWith.\n return (\n value.indexOf('*') === value.length - 1 &&\n request.url.startsWith(value.substr(0, value.length - 1))\n );\n };\n\n if (isHttpInterceptorRouteConfig(route)) {\n if (route.httpMethod && route.httpMethod !== request.method) {\n return false;\n }\n\n /* istanbul ignore if */\n if (!route.uri && !route.uriMatcher) {\n console.warn(\n 'Either a uri or uriMatcher is required when configuring the HTTP interceptor.'\n );\n }\n\n return route.uriMatcher\n ? route.uriMatcher(request.url)\n : testPrimitive(route.uri);\n }\n\n return testPrimitive(route);\n }\n\n /**\n * Tries to match a route from the SDK configuration to the HTTP request.\n * If a match is found, the route configuration is returned.\n *\n * @param request The Http request\n * @param config HttpInterceptorConfig\n */\n private findMatchingRoute(\n request: HttpRequest<any>,\n config: HttpInterceptorConfig\n ): Observable<ApiRouteDefinition | null> {\n return from(config.allowedList).pipe(\n first((route) => this.canAttachToken(route, request), null)\n );\n }\n\n private allowAnonymous(route: ApiRouteDefinition | null, err: any): boolean {\n return (\n !!route &&\n isHttpInterceptorRouteConfig(route) &&\n !!route.allowAnonymous &&\n ['login_required', 'consent_required'].includes(err.error)\n );\n }\n}\n","/*\n * Public API Surface of auth0-angular\n */\n\nexport * from './lib/auth.service';\nexport * from './lib/auth.module';\nexport * from './lib/auth.guard';\nexport * from './lib/auth.interceptor';\nexport * from './lib/auth.config';\nexport * from './lib/auth.client';\nexport * from './lib/auth.state';\nexport * from './lib/interfaces';\n\nexport {\n ICache,\n Cacheable,\n LocalStorageCache,\n InMemoryCache,\n IdToken,\n User\n} from '@auth0/auth0-spa-js';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.AuthClientConfig","i2.AbstractNavigator","i3.AuthState","i1.AuthService","i2.AuthState","i3.AuthService"],"mappings":";;;;;;;;;;AAAA,gBAAe,EAAE,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,OAAO,EAAE;;MCKpD,kBAAkB,CAAA;IA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ACH;IAEO,cAAc,CAAC,KAAgC,EAAE,GAAQ,EAAA;QAC/D,QACE,CAAC,CAAC,KAAK;YACP,4BAA4B,CAAC,KAAK,CAAC;YACnC,CAAC,CAAC,KAAK,CAAC,cAAc;AACtB,YAAA,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAC1D;KACH;;AA7KU,mBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,+CAGpB,kBAAkB,EAAA,EAAA,EAAA,KAAA,EAAAC,SAAA,EAAA,EAAA,EAAA,KAAA,EAAAC,WAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;qHAHjB,mBAAmB,EAAA,CAAA,CAAA;4FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,UAAU;;;8BAIN,MAAM;+BAAC,kBAAkB,CAAA;;;;ACzC9B;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { VERSION, InjectionToken, Injectable, Optional, Inject, NgModule } from '@angular/core';
|
|
3
3
|
import { BehaviorSubject, Subject, ReplaySubject, merge, defer, of, iif, from, throwError } from 'rxjs';
|
|
4
|
-
import { scan, filter, distinctUntilChanged, switchMap, mergeMap, shareReplay, concatMap, catchError, tap, takeUntil, withLatestFrom, map, take,
|
|
5
|
-
import
|
|
6
|
-
import * as i1$1 from '@auth0/auth0-spa-js';
|
|
4
|
+
import { scan, filter, distinctUntilChanged, switchMap, mergeMap, shareReplay, concatMap, catchError, tap, takeUntil, withLatestFrom, map, take, first, mapTo, pluck } from 'rxjs/operators';
|
|
5
|
+
import * as i4 from '@auth0/auth0-spa-js';
|
|
7
6
|
import { Auth0Client } from '@auth0/auth0-spa-js';
|
|
8
7
|
export { InMemoryCache, LocalStorageCache, User } from '@auth0/auth0-spa-js';
|
|
9
8
|
import { Router } from '@angular/router';
|
|
10
9
|
import * as i1 from '@angular/common';
|
|
11
10
|
|
|
12
|
-
var useragent = { name: '@auth0/auth0-angular', version: '
|
|
11
|
+
var useragent = { name: '@auth0/auth0-angular', version: '2.0.0' };
|
|
13
12
|
|
|
14
13
|
class Auth0ClientFactory {
|
|
15
14
|
static createClient(configFactory) {
|
|
@@ -17,20 +16,23 @@ class Auth0ClientFactory {
|
|
|
17
16
|
if (!config) {
|
|
18
17
|
throw new Error('Configuration must be specified either through AuthModule.forRoot or through AuthClientConfig.set');
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
return new Auth0Client({
|
|
20
|
+
...config,
|
|
21
|
+
auth0Client: {
|
|
22
22
|
name: useragent.name,
|
|
23
23
|
version: useragent.version,
|
|
24
24
|
env: {
|
|
25
25
|
'angular/core': VERSION.full,
|
|
26
26
|
},
|
|
27
|
-
}
|
|
27
|
+
},
|
|
28
|
+
});
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
const Auth0ClientService = new InjectionToken('auth0.client');
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* A custom type guard to help identify route definitions that are actually HttpInterceptorRouteConfig types.
|
|
35
|
+
*
|
|
34
36
|
* @param def The route definition type
|
|
35
37
|
*/
|
|
36
38
|
function isHttpInterceptorRouteConfig(def) {
|
|
@@ -86,6 +88,7 @@ class AuthClientConfig {
|
|
|
86
88
|
}
|
|
87
89
|
/**
|
|
88
90
|
* Sets configuration to be read by other consumers of the service (see usage notes)
|
|
91
|
+
*
|
|
89
92
|
* @param config The configuration to set
|
|
90
93
|
*/
|
|
91
94
|
set(config) {
|
|
@@ -98,9 +101,9 @@ class AuthClientConfig {
|
|
|
98
101
|
return this.config;
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
|
-
AuthClientConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
102
|
-
AuthClientConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
103
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
104
|
+
AuthClientConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthClientConfig, deps: [{ token: AuthConfigService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
105
|
+
AuthClientConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthClientConfig, providedIn: 'root' });
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthClientConfig, decorators: [{
|
|
104
107
|
type: Injectable,
|
|
105
108
|
args: [{ providedIn: 'root' }]
|
|
106
109
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
@@ -128,11 +131,12 @@ class AbstractNavigator {
|
|
|
128
131
|
try {
|
|
129
132
|
this.router = injector.get(Router);
|
|
130
133
|
}
|
|
131
|
-
catch
|
|
134
|
+
catch { }
|
|
132
135
|
}
|
|
133
136
|
/**
|
|
134
137
|
* Navigates to the specified url. The router will be used if one is available, otherwise it falls back
|
|
135
138
|
* to `window.history.replaceState`.
|
|
139
|
+
*
|
|
136
140
|
* @param url The url to navigate to
|
|
137
141
|
*/
|
|
138
142
|
navigateByUrl(url) {
|
|
@@ -143,9 +147,9 @@ class AbstractNavigator {
|
|
|
143
147
|
this.location.replaceState(url);
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
|
-
AbstractNavigator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
147
|
-
AbstractNavigator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
148
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
150
|
+
AbstractNavigator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AbstractNavigator, deps: [{ token: i1.Location }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
151
|
+
AbstractNavigator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AbstractNavigator, providedIn: 'root' });
|
|
152
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AbstractNavigator, decorators: [{
|
|
149
153
|
type: Injectable,
|
|
150
154
|
args: [{
|
|
151
155
|
providedIn: 'root',
|
|
@@ -170,12 +174,10 @@ class AuthState {
|
|
|
170
174
|
* Trigger used to pull User information from the Auth0Client.
|
|
171
175
|
* Triggers when the access token has changed.
|
|
172
176
|
*/
|
|
173
|
-
this.accessTokenTrigger$ = this.accessToken$.pipe(scan((acc, current) => {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
};
|
|
178
|
-
}, { current: null, previous: null }), filter(({ previous, current }) => previous !== current));
|
|
177
|
+
this.accessTokenTrigger$ = this.accessToken$.pipe(scan((acc, current) => ({
|
|
178
|
+
previous: acc.current,
|
|
179
|
+
current,
|
|
180
|
+
}), { current: null, previous: null }), filter(({ previous, current }) => previous !== current));
|
|
179
181
|
/**
|
|
180
182
|
* Trigger used to pull User information from the Auth0Client.
|
|
181
183
|
* Triggers when an event occurs that needs to retrigger the User Profile information.
|
|
@@ -196,7 +198,7 @@ class AuthState {
|
|
|
196
198
|
/**
|
|
197
199
|
* Emits details about the authenticated user, or null if not authenticated.
|
|
198
200
|
*/
|
|
199
|
-
this.user$ = this.isAuthenticatedTrigger$.pipe(concatMap((authenticated) => authenticated ? this.auth0Client.getUser() : of(null)));
|
|
201
|
+
this.user$ = this.isAuthenticatedTrigger$.pipe(concatMap((authenticated) => authenticated ? this.auth0Client.getUser() : of(null)), distinctUntilChanged());
|
|
200
202
|
/**
|
|
201
203
|
* Emits ID token claims when authenticated, or null if not authenticated.
|
|
202
204
|
*/
|
|
@@ -208,6 +210,7 @@ class AuthState {
|
|
|
208
210
|
}
|
|
209
211
|
/**
|
|
210
212
|
* Update the isLoading state using the provided value
|
|
213
|
+
*
|
|
211
214
|
* @param isLoading The new value for isLoading
|
|
212
215
|
*/
|
|
213
216
|
setIsLoading(isLoading) {
|
|
@@ -222,6 +225,7 @@ class AuthState {
|
|
|
222
225
|
}
|
|
223
226
|
/**
|
|
224
227
|
* Update the access token, doing so will also refresh the state.
|
|
228
|
+
*
|
|
225
229
|
* @param accessToken The new Access Token
|
|
226
230
|
*/
|
|
227
231
|
setAccessToken(accessToken) {
|
|
@@ -229,18 +233,19 @@ class AuthState {
|
|
|
229
233
|
}
|
|
230
234
|
/**
|
|
231
235
|
* Emits the error in the `error$` observable.
|
|
236
|
+
*
|
|
232
237
|
* @param error The new error
|
|
233
238
|
*/
|
|
234
239
|
setError(error) {
|
|
235
240
|
this.errorSubject$.next(error);
|
|
236
241
|
}
|
|
237
242
|
}
|
|
238
|
-
AuthState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
239
|
-
AuthState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
240
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
243
|
+
AuthState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthState, deps: [{ token: Auth0ClientService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
244
|
+
AuthState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthState, providedIn: 'root' });
|
|
245
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthState, decorators: [{
|
|
241
246
|
type: Injectable,
|
|
242
247
|
args: [{ providedIn: 'root' }]
|
|
243
|
-
}], ctorParameters: function () { return [{ type:
|
|
248
|
+
}], ctorParameters: function () { return [{ type: i4.Auth0Client, decorators: [{
|
|
244
249
|
type: Inject,
|
|
245
250
|
args: [Auth0ClientService]
|
|
246
251
|
}] }]; } });
|
|
@@ -344,20 +349,19 @@ class AuthService {
|
|
|
344
349
|
* Clears the application session and performs a redirect to `/v2/logout`, using
|
|
345
350
|
* the parameters provided as arguments, to clear the Auth0 session.
|
|
346
351
|
* If the `federated` option is specified it also clears the Identity Provider session.
|
|
347
|
-
* If the `
|
|
348
|
-
* It is invalid to set both the `federated` and `
|
|
352
|
+
* If the `openUrl` option is set to false, it only clears the application session.
|
|
353
|
+
* It is invalid to set both the `federated` to true and `openUrl` to `false`,
|
|
349
354
|
* and an error will be thrown if you do.
|
|
350
355
|
* [Read more about how Logout works at Auth0](https://auth0.com/docs/logout).
|
|
351
356
|
*
|
|
352
357
|
* @param options The logout options
|
|
353
358
|
*/
|
|
354
359
|
logout(options) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
if (options === null || options === void 0 ? void 0 : options.localOnly) {
|
|
360
|
+
return from(this.auth0Client.logout(options).then(() => {
|
|
361
|
+
if (options?.openUrl === false || options?.openUrl) {
|
|
358
362
|
this.authState.refresh();
|
|
359
363
|
}
|
|
360
|
-
});
|
|
364
|
+
}));
|
|
361
365
|
}
|
|
362
366
|
/**
|
|
363
367
|
* ```js
|
|
@@ -388,7 +392,7 @@ class AuthService {
|
|
|
388
392
|
*/
|
|
389
393
|
getAccessTokenSilently(options = {}) {
|
|
390
394
|
return of(this.auth0Client).pipe(concatMap((client) => options.detailedResponse === true
|
|
391
|
-
? client.getTokenSilently(
|
|
395
|
+
? client.getTokenSilently({ ...options, detailedResponse: true })
|
|
392
396
|
: client.getTokenSilently(options)), tap((token) => this.authState.setAccessToken(typeof token === 'string' ? token : token.access_token)), catchError((error) => {
|
|
393
397
|
this.authState.setError(error);
|
|
394
398
|
this.authState.refresh();
|
|
@@ -408,54 +412,16 @@ class AuthService {
|
|
|
408
412
|
* results will be valid according to their expiration times.
|
|
409
413
|
*/
|
|
410
414
|
getAccessTokenWithPopup(options) {
|
|
411
|
-
return of(this.auth0Client).pipe(concatMap((client) => client.getTokenWithPopup(options)), tap((token) =>
|
|
415
|
+
return of(this.auth0Client).pipe(concatMap((client) => client.getTokenWithPopup(options)), tap((token) => {
|
|
416
|
+
if (token) {
|
|
417
|
+
this.authState.setAccessToken(token);
|
|
418
|
+
}
|
|
419
|
+
}), catchError((error) => {
|
|
412
420
|
this.authState.setError(error);
|
|
413
421
|
this.authState.refresh();
|
|
414
422
|
return throwError(error);
|
|
415
423
|
}));
|
|
416
424
|
}
|
|
417
|
-
/**
|
|
418
|
-
* ```js
|
|
419
|
-
* getUser(options).subscribe(user => ...);
|
|
420
|
-
* ```
|
|
421
|
-
*
|
|
422
|
-
* Returns the user information if available (decoded
|
|
423
|
-
* from the `id_token`).
|
|
424
|
-
*
|
|
425
|
-
* If you provide an audience or scope, they should match an existing Access Token
|
|
426
|
-
* (the SDK stores a corresponding ID Token with every Access Token, and uses the
|
|
427
|
-
* scope and audience to look up the ID Token)
|
|
428
|
-
*
|
|
429
|
-
* @remarks
|
|
430
|
-
*
|
|
431
|
-
* The returned observable will emit once and then complete.
|
|
432
|
-
*
|
|
433
|
-
* @typeparam TUser The type to return, has to extend {@link User}.
|
|
434
|
-
* @param options The options to get the user
|
|
435
|
-
*/
|
|
436
|
-
getUser(options) {
|
|
437
|
-
return defer(() => this.auth0Client.getUser(options));
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* ```js
|
|
441
|
-
* getIdTokenClaims(options).subscribe(claims => ...);
|
|
442
|
-
* ```
|
|
443
|
-
*
|
|
444
|
-
* Returns all claims from the id_token if available.
|
|
445
|
-
*
|
|
446
|
-
* If you provide an audience or scope, they should match an existing Access Token
|
|
447
|
-
* (the SDK stores a corresponding ID Token with every Access Token, and uses the
|
|
448
|
-
* scope and audience to look up the ID Token)
|
|
449
|
-
*
|
|
450
|
-
* @remarks
|
|
451
|
-
*
|
|
452
|
-
* The returned observable will emit once and then complete.
|
|
453
|
-
*
|
|
454
|
-
* @param options The options to get the Id token claims
|
|
455
|
-
*/
|
|
456
|
-
getIdTokenClaims(options) {
|
|
457
|
-
return defer(() => this.auth0Client.getIdTokenClaims(options));
|
|
458
|
-
}
|
|
459
425
|
/**
|
|
460
426
|
* ```js
|
|
461
427
|
* handleRedirectCallback(url).subscribe(result => ...)
|
|
@@ -472,60 +438,34 @@ class AuthService {
|
|
|
472
438
|
*/
|
|
473
439
|
handleRedirectCallback(url) {
|
|
474
440
|
return defer(() => this.auth0Client.handleRedirectCallback(url)).pipe(withLatestFrom(this.authState.isLoading$), tap(([result, isLoading]) => {
|
|
475
|
-
var _a;
|
|
476
441
|
if (!isLoading) {
|
|
477
442
|
this.authState.refresh();
|
|
478
443
|
}
|
|
479
|
-
const appState = result
|
|
480
|
-
const target =
|
|
444
|
+
const appState = result?.appState;
|
|
445
|
+
const target = appState?.target ?? '/';
|
|
481
446
|
if (appState) {
|
|
482
447
|
this.appStateSubject$.next(appState);
|
|
483
448
|
}
|
|
484
449
|
this.navigator.navigateByUrl(target);
|
|
485
450
|
}), map(([result]) => result));
|
|
486
451
|
}
|
|
487
|
-
/**
|
|
488
|
-
* ```js
|
|
489
|
-
* buildAuthorizeUrl().subscribe(url => ...)
|
|
490
|
-
* ```
|
|
491
|
-
*
|
|
492
|
-
* Builds an `/authorize` URL for loginWithRedirect using the parameters
|
|
493
|
-
* provided as arguments. Random and secure `state` and `nonce`
|
|
494
|
-
* parameters will be auto-generated.
|
|
495
|
-
* @param options The options
|
|
496
|
-
* @returns A URL to the authorize endpoint
|
|
497
|
-
*/
|
|
498
|
-
buildAuthorizeUrl(options) {
|
|
499
|
-
return defer(() => this.auth0Client.buildAuthorizeUrl(options));
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* ```js
|
|
503
|
-
* buildLogoutUrl().subscribe(url => ...)
|
|
504
|
-
* ```
|
|
505
|
-
* Builds a URL to the logout endpoint.
|
|
506
|
-
*
|
|
507
|
-
* @param options The options used to configure the parameters that appear in the logout endpoint URL.
|
|
508
|
-
* @returns a URL to the logout endpoint using the parameters provided as arguments.
|
|
509
|
-
*/
|
|
510
|
-
buildLogoutUrl(options) {
|
|
511
|
-
return of(this.auth0Client.buildLogoutUrl(options));
|
|
512
|
-
}
|
|
513
452
|
shouldHandleCallback() {
|
|
514
453
|
return of(location.search).pipe(map((search) => {
|
|
515
|
-
|
|
516
|
-
|
|
454
|
+
const searchParams = new URLSearchParams(search);
|
|
455
|
+
return ((searchParams.has('code') || searchParams.has('error')) &&
|
|
456
|
+
searchParams.has('state') &&
|
|
517
457
|
!this.configFactory.get().skipRedirectCallback);
|
|
518
458
|
}));
|
|
519
459
|
}
|
|
520
460
|
}
|
|
521
|
-
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
522
|
-
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
523
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
461
|
+
AuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthService, deps: [{ token: Auth0ClientService }, { token: AuthClientConfig }, { token: AbstractNavigator }, { token: AuthState }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
462
|
+
AuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
463
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthService, decorators: [{
|
|
524
464
|
type: Injectable,
|
|
525
465
|
args: [{
|
|
526
466
|
providedIn: 'root',
|
|
527
467
|
}]
|
|
528
|
-
}], ctorParameters: function () { return [{ type:
|
|
468
|
+
}], ctorParameters: function () { return [{ type: i4.Auth0Client, decorators: [{
|
|
529
469
|
type: Inject,
|
|
530
470
|
args: [Auth0ClientService]
|
|
531
471
|
}] }, { type: AuthClientConfig }, { type: AbstractNavigator }, { type: AuthState }]; } });
|
|
@@ -553,9 +493,9 @@ class AuthGuard {
|
|
|
553
493
|
}));
|
|
554
494
|
}
|
|
555
495
|
}
|
|
556
|
-
AuthGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
557
|
-
AuthGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
558
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
496
|
+
AuthGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthGuard, deps: [{ token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
497
|
+
AuthGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthGuard, providedIn: 'root' });
|
|
498
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthGuard, decorators: [{
|
|
559
499
|
type: Injectable,
|
|
560
500
|
args: [{
|
|
561
501
|
providedIn: 'root',
|
|
@@ -566,6 +506,7 @@ class AuthModule {
|
|
|
566
506
|
/**
|
|
567
507
|
* Initialize the authentication module system. Configuration can either be specified here,
|
|
568
508
|
* or by calling AuthClientConfig.set (perhaps from an APP_INITIALIZER factory function).
|
|
509
|
+
*
|
|
569
510
|
* @param config The optional configuration for the SDK.
|
|
570
511
|
*/
|
|
571
512
|
static forRoot(config) {
|
|
@@ -587,39 +528,39 @@ class AuthModule {
|
|
|
587
528
|
};
|
|
588
529
|
}
|
|
589
530
|
}
|
|
590
|
-
AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
591
|
-
AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "
|
|
592
|
-
AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
593
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
531
|
+
AuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
532
|
+
AuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthModule });
|
|
533
|
+
AuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthModule });
|
|
534
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthModule, decorators: [{
|
|
594
535
|
type: NgModule
|
|
595
536
|
}] });
|
|
596
537
|
|
|
538
|
+
const waitUntil = (signal$) => (source$) => source$.pipe(mergeMap((value) => signal$.pipe(first(), mapTo(value))));
|
|
597
539
|
class AuthHttpInterceptor {
|
|
598
|
-
constructor(configFactory, auth0Client, authState) {
|
|
540
|
+
constructor(configFactory, auth0Client, authState, authService) {
|
|
599
541
|
this.configFactory = configFactory;
|
|
600
542
|
this.auth0Client = auth0Client;
|
|
601
543
|
this.authState = authState;
|
|
544
|
+
this.authService = authService;
|
|
602
545
|
}
|
|
603
546
|
intercept(req, next) {
|
|
604
|
-
var _a;
|
|
605
547
|
const config = this.configFactory.get();
|
|
606
|
-
if (!
|
|
548
|
+
if (!config.httpInterceptor?.allowedList) {
|
|
607
549
|
return next.handle(req);
|
|
608
550
|
}
|
|
551
|
+
const isLoaded$ = this.authService.isLoading$.pipe(filter((isLoading) => !isLoading));
|
|
609
552
|
return this.findMatchingRoute(req, config.httpInterceptor).pipe(concatMap((route) => iif(
|
|
610
553
|
// Check if a route was matched
|
|
611
554
|
() => route !== null,
|
|
612
555
|
// If we have a matching route, call getTokenSilently and attach the token to the
|
|
613
556
|
// outgoing request
|
|
614
|
-
of(route).pipe(pluck('tokenOptions'), concatMap((options) => {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
}));
|
|
622
|
-
}), switchMap((token) => {
|
|
557
|
+
of(route).pipe(waitUntil(isLoaded$), pluck('tokenOptions'), concatMap((options) => this.getAccessTokenSilently(options).pipe(catchError((err) => {
|
|
558
|
+
if (this.allowAnonymous(route, err)) {
|
|
559
|
+
return of('');
|
|
560
|
+
}
|
|
561
|
+
this.authState.setError(err);
|
|
562
|
+
return throwError(err);
|
|
563
|
+
}))), switchMap((token) => {
|
|
623
564
|
// Clone the request and attach the bearer token
|
|
624
565
|
const clone = token
|
|
625
566
|
? req.clone({
|
|
@@ -635,6 +576,7 @@ class AuthHttpInterceptor {
|
|
|
635
576
|
/**
|
|
636
577
|
* Duplicate of AuthService.getAccessTokenSilently, but with a slightly different error handling.
|
|
637
578
|
* Only used internally in the interceptor.
|
|
579
|
+
*
|
|
638
580
|
* @param options The options for configuring the token fetch.
|
|
639
581
|
*/
|
|
640
582
|
getAccessTokenSilently(options) {
|
|
@@ -645,6 +587,7 @@ class AuthHttpInterceptor {
|
|
|
645
587
|
}
|
|
646
588
|
/**
|
|
647
589
|
* Strips the query and fragment from the given uri
|
|
590
|
+
*
|
|
648
591
|
* @param uri The uri to remove the query and fragment from
|
|
649
592
|
*/
|
|
650
593
|
stripQueryFrom(uri) {
|
|
@@ -659,6 +602,7 @@ class AuthHttpInterceptor {
|
|
|
659
602
|
/**
|
|
660
603
|
* Determines whether the specified route can have an access token attached to it, based on matching the HTTP request against
|
|
661
604
|
* the interceptor route configuration.
|
|
605
|
+
*
|
|
662
606
|
* @param route The route to test
|
|
663
607
|
* @param request The HTTP request
|
|
664
608
|
*/
|
|
@@ -692,6 +636,7 @@ class AuthHttpInterceptor {
|
|
|
692
636
|
/**
|
|
693
637
|
* Tries to match a route from the SDK configuration to the HTTP request.
|
|
694
638
|
* If a match is found, the route configuration is returned.
|
|
639
|
+
*
|
|
695
640
|
* @param request The Http request
|
|
696
641
|
* @param config HttpInterceptorConfig
|
|
697
642
|
*/
|
|
@@ -705,14 +650,14 @@ class AuthHttpInterceptor {
|
|
|
705
650
|
['login_required', 'consent_required'].includes(err.error));
|
|
706
651
|
}
|
|
707
652
|
}
|
|
708
|
-
AuthHttpInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
709
|
-
AuthHttpInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
710
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
653
|
+
AuthHttpInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthHttpInterceptor, deps: [{ token: AuthClientConfig }, { token: Auth0ClientService }, { token: AuthState }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
654
|
+
AuthHttpInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthHttpInterceptor });
|
|
655
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: AuthHttpInterceptor, decorators: [{
|
|
711
656
|
type: Injectable
|
|
712
|
-
}], ctorParameters: function () { return [{ type: AuthClientConfig }, { type:
|
|
657
|
+
}], ctorParameters: function () { return [{ type: AuthClientConfig }, { type: i4.Auth0Client, decorators: [{
|
|
713
658
|
type: Inject,
|
|
714
659
|
args: [Auth0ClientService]
|
|
715
|
-
}] }, { type: AuthState }]; } });
|
|
660
|
+
}] }, { type: AuthState }, { type: AuthService }]; } });
|
|
716
661
|
|
|
717
662
|
/*
|
|
718
663
|
* Public API Surface of auth0-angular
|
|
@@ -723,4 +668,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
723
668
|
*/
|
|
724
669
|
|
|
725
670
|
export { Auth0ClientFactory, Auth0ClientService, AuthClientConfig, AuthConfigService, AuthGuard, AuthHttpInterceptor, AuthModule, AuthService, AuthState, isHttpInterceptorRouteConfig };
|
|
726
|
-
//# sourceMappingURL=auth0-auth0-angular.
|
|
671
|
+
//# sourceMappingURL=auth0-auth0-angular.mjs.map
|