@rxap/authentication 21.0.1 → 22.0.0-dev.1
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/CHANGELOG.md +19 -0
- package/compodoc/architecture.html +222 -0
- package/compodoc/changelog.html +62 -5
- package/compodoc/dependencies.html +96 -21
- package/compodoc/directives/SignOutDirective.html +140 -98
- package/compodoc/index.html +46 -5
- package/compodoc/injectables/AuthenticationRoutingService.html +69 -9
- package/compodoc/injectables/DisabledAuthenticationService.html +87 -21
- package/compodoc/injectables/RegisterService.html +77 -17
- package/compodoc/injectables/RxapAuthenticationGuard.html +105 -27
- package/compodoc/injectables/RxapAuthenticationService.html +98 -21
- package/compodoc/interfaces/AuthenticationAccessToken.html +172 -98
- package/compodoc/interfaces/AuthenticationEvent.html +131 -62
- package/compodoc/interfaces/IAuthenticationService.html +171 -115
- package/compodoc/js/architecture-graph.js +288 -0
- package/compodoc/js/libs/bootstrap-native.js +4 -2
- package/compodoc/js/libs/jszip.min.js +13 -0
- package/compodoc/js/libs/svg-pan-zoom.min.js +3 -3
- package/compodoc/js/libs/tablesort.min.js +3 -3
- package/compodoc/js/libs/tablesort.number.min.js +3 -3
- package/compodoc/js/libs/vis-network.min.js +78 -0
- package/compodoc/js/menu-wc.js +25 -12
- package/compodoc/js/menu.js +10 -11
- package/compodoc/js/routes/routes_index.js +1 -0
- package/compodoc/js/routes.js +142 -34
- package/compodoc/js/search/search-lunr.js +6 -8
- package/compodoc/js/search/search.js +118 -66
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/js/tabs.js +98 -15
- package/compodoc/js/tree.js +44 -7
- package/compodoc/license.html +48 -6
- package/compodoc/llms.txt +136 -0
- package/compodoc/miscellaneous/enumerations.html +45 -4
- package/compodoc/miscellaneous/functions.html +69 -20
- package/compodoc/miscellaneous/variables.html +72 -7
- package/compodoc/modules.html +44 -3
- package/compodoc/overview.html +54 -3
- package/compodoc/properties.html +45 -4
- package/compodoc/routes.html +227 -0
- package/compodoc/styles/compodoc.css +365 -44
- package/compodoc/styles/dark.css +16 -0
- package/compodoc/template-playground/default-templates.json +192 -0
- package/compodoc/template-playground/hbs-render.service.ts +217 -0
- package/compodoc/template-playground/main.ts +9 -0
- package/compodoc/template-playground/template-editor.service.ts +173 -0
- package/compodoc/template-playground/template-playground.component.ts +614 -0
- package/compodoc/template-playground/template-playground.module.ts +29 -0
- package/compodoc/template-playground/zip-export.service.ts +86 -0
- package/compodoc/template-playground-app/app.js +1389 -0
- package/compodoc/template-playground-app/index.html +462 -0
- package/docs/documentation.json +329 -206
- package/docs/html/assets/highlight.css +1 -1
- package/docs/html/assets/icons.js +1 -1
- package/docs/html/assets/icons.svg +1 -1
- package/docs/html/assets/main.js +5 -5
- package/docs/html/assets/search.js +1 -1
- package/docs/html/assets/style.css +265 -228
- package/docs/html/classes/AuthenticationRoutingService.html +58 -2
- package/docs/html/classes/DisabledAuthenticationService.html +112 -6
- package/docs/html/classes/RegisterService.html +81 -3
- package/docs/html/classes/RxapAuthenticationGuard.html +120 -7
- package/docs/html/classes/RxapAuthenticationService.html +114 -6
- package/docs/html/classes/SignOutDirective.html +94 -5
- package/docs/html/enums/AuthenticationEventType.html +66 -4
- package/docs/html/functions/BearerTokenInterceptor.html +43 -1
- package/docs/html/functions/provideAuthentication.html +43 -1
- package/docs/html/functions/withDisabledAuthentication.html +42 -1
- package/docs/html/functions/withInitialAuthenticationState.html +42 -1
- package/docs/html/hierarchy.html +34 -1
- package/docs/html/index.html +40 -4
- package/docs/html/interfaces/AuthenticationAccessToken.html +72 -3
- package/docs/html/interfaces/AuthenticationEvent.html +66 -2
- package/docs/html/interfaces/IAuthenticationService.html +94 -5
- package/docs/html/modules.html +52 -1
- package/docs/html/variables/RXAP_AUTHENTICATION_ACCESS_TOKEN.html +33 -1
- package/docs/html/variables/RXAP_AUTHENTICATION_DEACTIVATED.html +33 -1
- package/docs/html/variables/RXAP_INITIAL_AUTHENTICATION_STATE.html +33 -1
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/AuthenticationRoutingService.md +6 -6
- package/docs/markdown/classes/DisabledAuthenticationService.md +12 -12
- package/docs/markdown/classes/RegisterService.md +7 -7
- package/docs/markdown/classes/RxapAuthenticationGuard.md +11 -11
- package/docs/markdown/classes/RxapAuthenticationService.md +14 -14
- package/docs/markdown/classes/SignOutDirective.md +8 -8
- package/docs/markdown/enumerations/AuthenticationEventType.md +5 -5
- package/docs/markdown/functions/BearerTokenInterceptor.md +2 -2
- package/docs/markdown/functions/provideAuthentication.md +2 -2
- package/docs/markdown/functions/withDisabledAuthentication.md +4 -4
- package/docs/markdown/functions/withInitialAuthenticationState.md +2 -2
- package/docs/markdown/globals.md +2 -2
- package/docs/markdown/interfaces/AuthenticationAccessToken.md +6 -6
- package/docs/markdown/interfaces/AuthenticationEvent.md +4 -4
- package/docs/markdown/interfaces/IAuthenticationService.md +7 -7
- package/docs/markdown/variables/RXAP_AUTHENTICATION_ACCESS_TOKEN.md +3 -3
- package/docs/markdown/variables/RXAP_AUTHENTICATION_DEACTIVATED.md +2 -2
- package/docs/markdown/variables/RXAP_INITIAL_AUTHENTICATION_STATE.md +2 -2
- package/docs/wiki/Class.AuthenticationRoutingService.md +5 -5
- package/docs/wiki/Class.DisabledAuthenticationService.md +11 -11
- package/docs/wiki/Class.RegisterService.md +6 -6
- package/docs/wiki/Class.RxapAuthenticationGuard.md +10 -10
- package/docs/wiki/Class.RxapAuthenticationService.md +13 -13
- package/docs/wiki/Class.SignOutDirective.md +7 -7
- package/docs/wiki/Enumeration.AuthenticationEventType.md +4 -4
- package/docs/wiki/Function.BearerTokenInterceptor.md +1 -1
- package/docs/wiki/Function.provideAuthentication.md +1 -1
- package/docs/wiki/Function.withDisabledAuthentication.md +3 -3
- package/docs/wiki/Function.withInitialAuthenticationState.md +1 -1
- package/docs/wiki/Interface.AuthenticationAccessToken.md +5 -5
- package/docs/wiki/Interface.AuthenticationEvent.md +3 -3
- package/docs/wiki/Interface.IAuthenticationService.md +6 -6
- package/docs/wiki/Variable.RXAP_AUTHENTICATION_ACCESS_TOKEN.md +2 -2
- package/docs/wiki/Variable.RXAP_AUTHENTICATION_DEACTIVATED.md +1 -1
- package/docs/wiki/Variable.RXAP_INITIAL_AUTHENTICATION_STATE.md +1 -1
- package/docs/wiki/globals.md +1 -1
- package/fesm2022/rxap-authentication.mjs +272 -148
- package/fesm2022/rxap-authentication.mjs.map +1 -1
- package/package.json +13 -13
- package/types/rxap-authentication.d.ts +79 -86
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rxap-authentication.mjs","sources":["../../../../../packages/angular/authentication/src/lib/tokens.ts","../../../../../packages/angular/authentication/src/lib/authentication.service.ts","../../../../../packages/angular/authentication/src/lib/authentication-routing.service.ts","../../../../../packages/angular/authentication/src/lib/authentication.guard.ts","../../../../../packages/angular/authentication/src/lib/bearer-token.interceptor.ts","../../../../../packages/angular/authentication/src/lib/disabled-authentication.service.ts","../../../../../packages/angular/authentication/src/lib/provide.ts","../../../../../packages/angular/authentication/src/lib/register.service.ts","../../../../../packages/angular/authentication/src/lib/sign-out.directive.ts","../../../../../packages/angular/authentication/src/index.ts","../../../../../packages/angular/authentication/src/rxap-authentication.ts"],"sourcesContent":["import {\n InjectionToken,\n Provider,\n} from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\n\nexport const RXAP_AUTHENTICATION_DEACTIVATED = new InjectionToken<boolean>('rxap/authentication/deactivated');\n\nexport interface AuthenticationAccessToken extends Record<string, any> {\n token: string;\n valid?: boolean;\n}\n\nexport const RXAP_AUTHENTICATION_ACCESS_TOKEN = new InjectionToken<BehaviorSubject<AuthenticationAccessToken | null>>(\n 'rxap/authentication/access-token',\n {\n providedIn: 'root',\n factory: () => new BehaviorSubject<AuthenticationAccessToken | null>(null),\n },\n);\n\nexport const RXAP_INITIAL_AUTHENTICATION_STATE = new InjectionToken<boolean>('rxap/authentication/initial-state', {\n providedIn: 'root',\n factory: () => false,\n});\n\nexport function withDisabledAuthentication(disabled = true): Provider {\n return {\n provide: RXAP_AUTHENTICATION_DEACTIVATED,\n useValue: disabled,\n };\n}\n","import {\n inject,\n Injectable,\n} from '@angular/core';\nimport {\n BehaviorSubject,\n Observable,\n ReplaySubject,\n} from 'rxjs';\nimport { RXAP_INITIAL_AUTHENTICATION_STATE } from './tokens';\n\nexport interface IAuthenticationService {\n isAuthenticated$: Observable<boolean | null>;\n events$: Observable<AuthenticationEvent>;\n signOut(): Promise<void>;\n\n isAuthenticated(): Promise<boolean>;\n}\n\nexport enum AuthenticationEventType {\n OnAuthSuccess = 'on-auth-success',\n OnAuthError = 'on-auth-error',\n OnLogout = 'on-logout',\n}\n\nexport interface AuthenticationEvent extends Record<string, any> {\n type: AuthenticationEventType;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class RxapAuthenticationService implements IAuthenticationService {\n\n public isAuthenticated$ = new BehaviorSubject<boolean | null>(null);\n\n public readonly events$ = new ReplaySubject<AuthenticationEvent>();\n\n private _authenticated = inject(RXAP_INITIAL_AUTHENTICATION_STATE);\n\n constructor() {\n this.isAuthenticated().then(isAuthenticated => this.isAuthenticated$.next(isAuthenticated));\n }\n\n public async signOut(): Promise<void> {\n this._authenticated = false;\n this.isAuthenticated$.next(this._authenticated);\n this.events$.next({ type: AuthenticationEventType.OnLogout });\n }\n\n public isAuthenticated(): Promise<boolean> {\n return Promise.resolve(this._authenticated);\n }\n\n}\n","import { Injectable, inject } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { RxapAuthenticationService } from './authentication.service';\nimport { RXAP_AUTHENTICATION_DEACTIVATED } from './tokens';\nimport { tap } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthenticationRoutingService {\n private readonly router = inject<Router>(Router);\n private readonly authenticationService = inject<RxapAuthenticationService>(RxapAuthenticationService);\n private readonly deactivated = inject(RXAP_AUTHENTICATION_DEACTIVATED, { optional: true }) ?? null;\n\n\n constructor() {\n const deactivated = this.deactivated;\n\n if (!deactivated) {\n console.log('Authentication is enabled');\n this.authenticationService.isAuthenticated$.pipe(\n tap(isAuthenticated => {\n if (isAuthenticated) {\n return this.router.navigate([ '/' ]);\n } else {\n return this.router.navigate([ '/', 'authentication', 'login' ]);\n }\n }),\n ).subscribe();\n }\n }\n\n}\n","import { Injectable, inject } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot,\n UrlTree,\n} from '@angular/router';\nimport { RxapAuthenticationService } from './authentication.service';\nimport { RXAP_AUTHENTICATION_DEACTIVATED } from './tokens';\n\n@Injectable({ providedIn: 'root' })\nexport class RxapAuthenticationGuard {\n authentication = inject<RxapAuthenticationService>(RxapAuthenticationService);\n router = inject<Router>(Router);\n private readonly deactivated = inject(RXAP_AUTHENTICATION_DEACTIVATED, { optional: true }) ?? null;\n\n\n public lastUrl: string | null = null;\n\n public canActivate(\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot,\n ): Promise<UrlTree | boolean> {\n console.debug('[RxapAuthenticationGuard] can activate', state.url);\n return this.checkAuthStatus(route, state);\n }\n\n public canActivateChild(\n childRoute: ActivatedRouteSnapshot,\n state: RouterStateSnapshot,\n ): Promise<UrlTree | boolean> {\n console.debug('[RxapAuthenticationGuard] can activate child', state.url);\n return this.checkAuthStatus(childRoute, state);\n }\n\n private async checkAuthStatus(\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot,\n ): Promise<UrlTree | boolean> {\n\n if (this.deactivated) {\n return true;\n }\n\n const authenticated = await this.authentication.isAuthenticated();\n\n if (authenticated === null) {\n if (!this.lastUrl || (state.url !== '/' && !state.url.match(/authentication\\/login/))) {\n this.lastUrl = state.url;\n }\n return this.router.createUrlTree([ '/', 'authentication', 'loading' ]);\n }\n if (authenticated) {\n if (this.lastUrl && (state.url/*?*/ === '/' || state.url.match(/authentication\\/login/))) {\n const lastUrl = this.lastUrl;\n this.lastUrl = null;\n return this.createUrlTreeToLastUrl(lastUrl);\n } else {\n if (state.url.match(/authentication/)) {\n if (state.url.match(/authentication\\/reset-password/)) {\n return true;\n }\n return this.router.createUrlTree([ '/' ]);\n } else {\n this.lastUrl = null;\n return true;\n }\n }\n } else {\n if (!state.url.match(/^\\/?authentication/)) {\n this.lastUrl = state.url;\n }\n if (state.url.match(/^\\/?authentication/)) {\n if (this.lastUrl && this.lastUrl.match(/^\\/?authentication/)) {\n const lastUrl = this.lastUrl;\n this.lastUrl = null;\n return this.createUrlTreeToLastUrl(lastUrl);\n }\n return true;\n } else {\n return this.router.createUrlTree([ '/', 'authentication', 'login' ]);\n }\n }\n\n }\n\n private createUrlTreeToLastUrl(lastUrl: string): UrlTree {\n\n const urlMatch = lastUrl.match(/^([^?#]+)(\\?([^#]+))?(#(.+))?$/);\n\n if (urlMatch) {\n\n let queryParams: Record<string, string> = {};\n\n if (urlMatch[3]) {\n const queryParamsString = urlMatch[3];\n queryParams = queryParamsString.split('&').map(param => {\n const split = param.split('=');\n return { [split[0]]: split[1] };\n }).reduce((params, param) => ({ ...params, ...param }), {});\n }\n\n let fragment: string | undefined = undefined;\n\n if (urlMatch[5]) {\n fragment = urlMatch[5];\n }\n\n return this.router.createUrlTree([ urlMatch[1] ], {\n queryParams,\n fragment,\n });\n\n }\n\n return this.router.createUrlTree([ lastUrl ]);\n\n }\n\n}\n","import { HttpEvent, HttpHandlerFn, HttpRequest } from '@angular/common/http';\nimport { inject } from '@angular/core';\nimport {\n Observable,\n switchMap,\n take,\n} from 'rxjs';\nimport { RXAP_AUTHENTICATION_ACCESS_TOKEN } from './tokens';\n\nexport function BearerTokenInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>> {\n\n const accessToken$ = inject(RXAP_AUTHENTICATION_ACCESS_TOKEN);\n\n if (req.url.match(/https?:\\/\\/[^/]+\\/api/)) {\n return accessToken$.pipe(\n take(1),\n switchMap(accessToken => {\n if (accessToken && (accessToken.valid === undefined || accessToken.valid)) {\n console.debug('Add access token to request', req.url);\n return next(req.clone({\n setHeaders: {\n Authorization: `Bearer ${ accessToken.token }`,\n },\n }));\n } else {\n console.debug('No valid access token found!', req.url);\n }\n return next(req);\n }),\n );\n } else {\n console.debug('Skip adding access token to request', req.url);\n }\n\n return next(req);\n\n}\n","import { Injectable } from '@angular/core';\nimport {\n EMPTY,\n of,\n} from 'rxjs';\nimport { IAuthenticationService } from './authentication.service';\n\n@Injectable()\nexport class DisabledAuthenticationService implements IAuthenticationService {\n\n public readonly isAuthenticated$ = of(true);\n public readonly events$ = EMPTY;\n\n async signOut() {\n console.log('Authentication is disabled. No sign out possible');\n }\n\n async isAuthenticated() {\n return true;\n }\n\n}\n","import { Provider } from '@angular/core';\nimport { RXAP_INITIAL_AUTHENTICATION_STATE } from './tokens';\nimport {\n IAuthenticationService,\n RxapAuthenticationService,\n} from './authentication.service';\nimport { Constructor } from '@rxap/utilities';\n\nexport function provideAuthentication(\n service: Constructor<IAuthenticationService>,\n ...additionalProviders: Provider[]\n): Provider[] {\n return [\n {\n provide: RxapAuthenticationService,\n useClass: service,\n },\n ...additionalProviders,\n ];\n}\n\nexport function withInitialAuthenticationState(\n state: boolean\n): Provider {\n return {\n provide: RXAP_INITIAL_AUTHENTICATION_STATE,\n useValue: state,\n };\n}\n","import { Injectable } from '@angular/core';\n\n@Injectable({ providedIn: 'root' })\n/* ignore coverage */\nexport class RegisterService {\n\n constructor() {\n console.warn('The default RegisterService implementation should only be used in a development environment!');\n }\n\n public register(email: string, password: string): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n}\n","import { Directive, output, inject } from '@angular/core';\nimport { RxapAuthenticationService } from './authentication.service';\n\n@Directive({\n selector: '[rxapSignOut]',\n standalone: true,\n host: {\n '(click)': 'onClick()',\n },\n})\nexport class SignOutDirective {\n private readonly auth = inject(RxapAuthenticationService);\n\n\n public readonly successful = output<void>();\n\n public readonly failure = output<Error>();\n\n public async onClick() {\n try {\n await this.auth.signOut();\n this.successful.emit();\n } catch (e: any) {\n this.failure.emit(e);\n }\n }\n\n}\n\n\n","// region \nexport * from './lib/authentication-routing.service';\nexport * from './lib/authentication.guard';\nexport * from './lib/authentication.service';\nexport * from './lib/bearer-token.interceptor';\nexport * from './lib/disabled-authentication.service';\nexport * from './lib/provide';\nexport * from './lib/register.service';\nexport * from './lib/sign-out.directive';\nexport * from './lib/tokens';\n// endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAMa,+BAA+B,GAAG,IAAI,cAAc,CAAU,iCAAiC;MAO/F,gCAAgC,GAAG,IAAI,cAAc,CAChE,kCAAkC,EAClC;AACE,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM,IAAI,eAAe,CAAmC,IAAI,CAAC;AAC3E,CAAA;MAGU,iCAAiC,GAAG,IAAI,cAAc,CAAU,mCAAmC,EAAE;AAChH,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,KAAK;AACrB,CAAA;AAEK,SAAU,0BAA0B,CAAC,QAAQ,GAAG,IAAI,EAAA;IACxD,OAAO;AACL,QAAA,OAAO,EAAE,+BAA+B;AACxC,QAAA,QAAQ,EAAE,QAAQ;KACnB;AACH;;ICZY;AAAZ,CAAA,UAAY,uBAAuB,EAAA;AACjC,IAAA,uBAAA,CAAA,eAAA,CAAA,GAAA,iBAAiC;AACjC,IAAA,uBAAA,CAAA,aAAA,CAAA,GAAA,eAA6B;AAC7B,IAAA,uBAAA,CAAA,UAAA,CAAA,GAAA,WAAsB;AACxB,CAAC,EAJW,uBAAuB,KAAvB,uBAAuB,GAAA,EAAA,CAAA,CAAA;MAWtB,yBAAyB,CAAA;AAQpC,IAAA,WAAA,GAAA;AANO,QAAA,IAAA,CAAA,gBAAgB,GAAG,IAAI,eAAe,CAAiB,IAAI,CAAC;AAEnD,QAAA,IAAA,CAAA,OAAO,GAAG,IAAI,aAAa,EAAuB;AAE1D,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iCAAiC,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,IAAA,MAAM,OAAO,GAAA;AAClB,QAAA,IAAI;AACF,YAAA,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;AACzB,YAAA,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;QACxB;QAAE,OAAO,CAAM,EAAE;AACf,YAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACtB;IACF;8GAfW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAhB,gBAAgB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,eAAA,EAAA,OAAA,EAAA,EAAA,UAAA,EAAA,YAAA,EAAA,OAAA,EAAA,SAAA,EAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,WAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAP5B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,eAAe;AACzB,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE,WAAW;AACvB,qBAAA;AACF,iBAAA;;;ACTD;AAUA;;ACVA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"rxap-authentication.mjs","names":[],"sources":["../../../../../packages/angular/authentication/src/lib/tokens.ts","../../../../../packages/angular/authentication/src/lib/authentication.service.ts","../../../../../packages/angular/authentication/src/lib/authentication-routing.service.ts","../../../../../packages/angular/authentication/src/lib/authentication.guard.ts","../../../../../packages/angular/authentication/src/lib/bearer-token.interceptor.ts","../../../../../packages/angular/authentication/src/lib/disabled-authentication.service.ts","../../../../../packages/angular/authentication/src/lib/provide.ts","../../../../../packages/angular/authentication/src/lib/register.service.ts","../../../../../packages/angular/authentication/src/lib/sign-out.directive.ts"],"sourcesContent":["import {\n InjectionToken,\n Provider,\n} from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\n\nexport const RXAP_AUTHENTICATION_DEACTIVATED = new InjectionToken<boolean>('rxap/authentication/deactivated');\n\nexport interface AuthenticationAccessToken extends Record<string, any> {\n token: string;\n valid?: boolean;\n}\n\nexport const RXAP_AUTHENTICATION_ACCESS_TOKEN = new InjectionToken<BehaviorSubject<AuthenticationAccessToken | null>>(\n 'rxap/authentication/access-token',\n {\n providedIn: 'root',\n factory: () => new BehaviorSubject<AuthenticationAccessToken | null>(null),\n },\n);\n\nexport const RXAP_INITIAL_AUTHENTICATION_STATE = new InjectionToken<boolean>('rxap/authentication/initial-state', {\n providedIn: 'root',\n factory: () => false,\n});\n\nexport function withDisabledAuthentication(disabled = true): Provider {\n return {\n provide: RXAP_AUTHENTICATION_DEACTIVATED,\n useValue: disabled,\n };\n}\n","import {\n inject,\n Injectable,\n} from '@angular/core';\nimport {\n BehaviorSubject,\n Observable,\n ReplaySubject,\n} from 'rxjs';\nimport { RXAP_INITIAL_AUTHENTICATION_STATE } from './tokens';\n\nexport interface IAuthenticationService {\n isAuthenticated$: Observable<boolean | null>;\n events$: Observable<AuthenticationEvent>;\n signOut(): Promise<void>;\n\n isAuthenticated(): Promise<boolean>;\n}\n\nexport enum AuthenticationEventType {\n OnAuthSuccess = 'on-auth-success',\n OnAuthError = 'on-auth-error',\n OnLogout = 'on-logout',\n}\n\nexport interface AuthenticationEvent extends Record<string, any> {\n type: AuthenticationEventType;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class RxapAuthenticationService implements IAuthenticationService {\n\n public isAuthenticated$ = new BehaviorSubject<boolean | null>(null);\n\n public readonly events$ = new ReplaySubject<AuthenticationEvent>();\n\n private _authenticated = inject(RXAP_INITIAL_AUTHENTICATION_STATE);\n\n constructor() {\n this.isAuthenticated().then(isAuthenticated => this.isAuthenticated$.next(isAuthenticated));\n }\n\n public async signOut(): Promise<void> {\n this._authenticated = false;\n this.isAuthenticated$.next(this._authenticated);\n this.events$.next({ type: AuthenticationEventType.OnLogout });\n }\n\n public isAuthenticated(): Promise<boolean> {\n return Promise.resolve(this._authenticated);\n }\n\n}\n","import { Injectable, inject } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { RxapAuthenticationService } from './authentication.service';\nimport { RXAP_AUTHENTICATION_DEACTIVATED } from './tokens';\nimport { tap } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthenticationRoutingService {\n private readonly router = inject<Router>(Router);\n private readonly authenticationService = inject<RxapAuthenticationService>(RxapAuthenticationService);\n private readonly deactivated = inject(RXAP_AUTHENTICATION_DEACTIVATED, { optional: true }) ?? null;\n\n\n constructor() {\n const deactivated = this.deactivated;\n\n if (!deactivated) {\n console.log('Authentication is enabled');\n this.authenticationService.isAuthenticated$.pipe(\n tap(isAuthenticated => {\n if (isAuthenticated) {\n return this.router.navigate([ '/' ]);\n } else {\n return this.router.navigate([ '/', 'authentication', 'login' ]);\n }\n }),\n ).subscribe();\n }\n }\n\n}\n","import { Injectable, inject } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n Router,\n RouterStateSnapshot,\n UrlTree,\n} from '@angular/router';\nimport { RxapAuthenticationService } from './authentication.service';\nimport { RXAP_AUTHENTICATION_DEACTIVATED } from './tokens';\n\n@Injectable({ providedIn: 'root' })\nexport class RxapAuthenticationGuard {\n authentication = inject<RxapAuthenticationService>(RxapAuthenticationService);\n router = inject<Router>(Router);\n private readonly deactivated = inject(RXAP_AUTHENTICATION_DEACTIVATED, { optional: true }) ?? null;\n\n\n public lastUrl: string | null = null;\n\n public canActivate(\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot,\n ): Promise<UrlTree | boolean> {\n console.debug('[RxapAuthenticationGuard] can activate', state.url);\n return this.checkAuthStatus(route, state);\n }\n\n public canActivateChild(\n childRoute: ActivatedRouteSnapshot,\n state: RouterStateSnapshot,\n ): Promise<UrlTree | boolean> {\n console.debug('[RxapAuthenticationGuard] can activate child', state.url);\n return this.checkAuthStatus(childRoute, state);\n }\n\n private async checkAuthStatus(\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot,\n ): Promise<UrlTree | boolean> {\n\n if (this.deactivated) {\n return true;\n }\n\n const authenticated = await this.authentication.isAuthenticated();\n\n if (authenticated === null) {\n if (!this.lastUrl || (state.url !== '/' && !state.url.match(/authentication\\/login/))) {\n this.lastUrl = state.url;\n }\n return this.router.createUrlTree([ '/', 'authentication', 'loading' ]);\n }\n if (authenticated) {\n if (this.lastUrl && (state.url/*?*/ === '/' || state.url.match(/authentication\\/login/))) {\n const lastUrl = this.lastUrl;\n this.lastUrl = null;\n return this.createUrlTreeToLastUrl(lastUrl);\n } else {\n if (state.url.match(/authentication/)) {\n if (state.url.match(/authentication\\/reset-password/)) {\n return true;\n }\n return this.router.createUrlTree([ '/' ]);\n } else {\n this.lastUrl = null;\n return true;\n }\n }\n } else {\n if (!state.url.match(/^\\/?authentication/)) {\n this.lastUrl = state.url;\n }\n if (state.url.match(/^\\/?authentication/)) {\n if (this.lastUrl && this.lastUrl.match(/^\\/?authentication/)) {\n const lastUrl = this.lastUrl;\n this.lastUrl = null;\n return this.createUrlTreeToLastUrl(lastUrl);\n }\n return true;\n } else {\n return this.router.createUrlTree([ '/', 'authentication', 'login' ]);\n }\n }\n\n }\n\n private createUrlTreeToLastUrl(lastUrl: string): UrlTree {\n\n const urlMatch = lastUrl.match(/^([^?#]+)(\\?([^#]+))?(#(.+))?$/);\n\n if (urlMatch) {\n\n let queryParams: Record<string, string> = {};\n\n if (urlMatch[3]) {\n const queryParamsString = urlMatch[3];\n queryParams = queryParamsString.split('&').map(param => {\n const split = param.split('=');\n return { [split[0]]: split[1] };\n }).reduce((params, param) => ({ ...params, ...param }), {});\n }\n\n let fragment: string | undefined = undefined;\n\n if (urlMatch[5]) {\n fragment = urlMatch[5];\n }\n\n return this.router.createUrlTree([ urlMatch[1] ], {\n queryParams,\n fragment,\n });\n\n }\n\n return this.router.createUrlTree([ lastUrl ]);\n\n }\n\n}\n","import { HttpEvent, HttpHandlerFn, HttpRequest } from '@angular/common/http';\nimport { inject } from '@angular/core';\nimport {\n Observable,\n switchMap,\n take,\n} from 'rxjs';\nimport { RXAP_AUTHENTICATION_ACCESS_TOKEN } from './tokens';\n\nexport function BearerTokenInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>> {\n\n const accessToken$ = inject(RXAP_AUTHENTICATION_ACCESS_TOKEN);\n\n if (req.url.match(/https?:\\/\\/[^/]+\\/api/)) {\n return accessToken$.pipe(\n take(1),\n switchMap(accessToken => {\n if (accessToken && (accessToken.valid === undefined || accessToken.valid)) {\n console.debug('Add access token to request', req.url);\n return next(req.clone({\n setHeaders: {\n Authorization: `Bearer ${ accessToken.token }`,\n },\n }));\n } else {\n console.debug('No valid access token found!', req.url);\n }\n return next(req);\n }),\n );\n } else {\n console.debug('Skip adding access token to request', req.url);\n }\n\n return next(req);\n\n}\n","import { Injectable } from '@angular/core';\nimport {\n EMPTY,\n of,\n} from 'rxjs';\nimport { IAuthenticationService } from './authentication.service';\n\n@Injectable()\nexport class DisabledAuthenticationService implements IAuthenticationService {\n\n public readonly isAuthenticated$ = of(true);\n public readonly events$ = EMPTY;\n\n async signOut() {\n console.log('Authentication is disabled. No sign out possible');\n }\n\n async isAuthenticated() {\n return true;\n }\n\n}\n","import { Provider } from '@angular/core';\nimport { RXAP_INITIAL_AUTHENTICATION_STATE } from './tokens';\nimport {\n IAuthenticationService,\n RxapAuthenticationService,\n} from './authentication.service';\nimport { Constructor } from '@rxap/utilities';\n\nexport function provideAuthentication(\n service: Constructor<IAuthenticationService>,\n ...additionalProviders: Provider[]\n): Provider[] {\n return [\n {\n provide: RxapAuthenticationService,\n useClass: service,\n },\n ...additionalProviders,\n ];\n}\n\nexport function withInitialAuthenticationState(\n state: boolean\n): Provider {\n return {\n provide: RXAP_INITIAL_AUTHENTICATION_STATE,\n useValue: state,\n };\n}\n","import { Injectable } from '@angular/core';\n\n@Injectable({ providedIn: 'root' })\n/* ignore coverage */\nexport class RegisterService {\n\n constructor() {\n console.warn('The default RegisterService implementation should only be used in a development environment!');\n }\n\n public register(email: string, password: string): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n}\n","import { Directive, output, inject } from '@angular/core';\nimport { RxapAuthenticationService } from './authentication.service';\nimport { Showcase } from '@ng-prism/core';\n\n@Showcase<SignOutDirective>({\n title: 'Sign Out',\n category: 'Authentication',\n description: 'Signs the user out when the host element is clicked. The `successful` output emits after the sign out, `failure` emits with the error. The authentication service of the styleguide host does not need a backend.',\n status: 'stable',\n host: '<button type=\"button\">Sign out</button>',\n variants: [\n { name: 'Default' },\n ],\n})\n@Directive({\n selector: '[rxapSignOut]',\n standalone: true,\n host: {\n '(click)': 'onClick()',\n },\n})\nexport class SignOutDirective {\n private readonly auth = inject(RxapAuthenticationService);\n\n\n public readonly successful = output<void>();\n\n public readonly failure = output<Error>();\n\n public async onClick() {\n try {\n await this.auth.signOut();\n this.successful.emit();\n } catch (e: any) {\n this.failure.emit(e);\n }\n }\n\n}\n\n\n"],"mappings":";;;;;;;AAMA,MAAa,kCAAkC,IAAI,eAAwB,iCAAiC;AAO5G,MAAa,mCAAmC,IAAI,eAClD,oCACA;CACE,YAAY;CACZ,eAAe,IAAI,gBAAkD,IAAI;AAC1E,CAAA;AAGH,MAAa,oCAAoC,IAAI,eAAwB,qCAAqC;CAChH,YAAY;CACZ,eAAe;AAChB,CAAA;AAED,SAAgB,2BAA2B,WAAW,MAAI;CACxD,OAAO;EACL,SAAS;EACT,UAAU;CACX;AACH;ACZA,IAAY;CAAZ,SAAY,yBAAuB;CACjC,wBAAA,mBAAA;CACA,wBAAA,iBAAA;CACA,wBAAA,cAAA;AACF,EAAA,CAJY,4BAAA,0BAAuB,CAAA,EAAA;AAWnC,IAAa,4BAAb,MAAa,0BAAyB;CAQpC,cAAA;EANO,KAAA,mBAAmB,IAAI,gBA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OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAgB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAhB;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAAgB,cAAA;GAAA,UAAA;GAAA,SAAA;IAAA,YAAA;IAAA,SAAA;GAAA;GAAA,MAAA,EAAA,WAAA,EAAA,SAAA,YAAA,EAAA;GAAA,UAAA;EAAA,CAAA;CAAA;;AAAhB,mBAAgB,WAAA,CAjB5B,SAA2B;CAC1B,OAAO;CACP,UAAU;CACV,aAAa;CACb,QAAQ;CACR,MAAM;CACN,UAAU,CACR,EAAE,MAAM,UAAS,CAClB;AACF,CAAA,CAQY,GAAA,gBAAgB;AAAhB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAgB,YAAA,CAAA;EAP5B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,YAAY;GACZ,MAAM,EACJ,WAAW,YACZ;EACF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "22.0.0-dev.1",
|
|
3
3
|
"name": "@rxap/authentication",
|
|
4
4
|
"description": "Provides authentication services, guards, and interceptors for Angular applications. It supports token-based authentication and provides features such as sign-out functionality and routing based on authentication status. This package also includes utilities for disabling authentication in certain environments and managing access tokens.\n",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@nx/devkit": "
|
|
8
|
-
"tslib": "2.
|
|
7
|
+
"@nx/devkit": "24.0.6",
|
|
8
|
+
"tslib": "2.9.1"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@angular/common": "^
|
|
12
|
-
"@angular/core": "^
|
|
13
|
-
"@angular/router": "^
|
|
14
|
-
"@rxap/utilities": "^16.5.
|
|
15
|
-
"rxjs": "^7.
|
|
11
|
+
"@angular/common": "^22.0.0",
|
|
12
|
+
"@angular/core": "^22.0.0",
|
|
13
|
+
"@angular/router": "^22.0.0",
|
|
14
|
+
"@rxap/utilities": "^16.5.3-dev.0",
|
|
15
|
+
"rxjs": "^7.0.0"
|
|
16
16
|
},
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "Merzough Münker",
|
|
@@ -37,23 +37,23 @@
|
|
|
37
37
|
"packageGroup": [
|
|
38
38
|
{
|
|
39
39
|
"package": "@angular/common",
|
|
40
|
-
"version": "
|
|
40
|
+
"version": "22.3.0"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
"package": "@angular/core",
|
|
44
|
-
"version": "
|
|
44
|
+
"version": "22.3.0"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"package": "@angular/platform-browser",
|
|
48
|
-
"version": "
|
|
48
|
+
"version": "22.3.0"
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
"package": "@angular/router",
|
|
52
|
-
"version": "
|
|
52
|
+
"version": "22.3.0"
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
"package": "@rxap/utilities",
|
|
56
|
-
"version": "16.5.
|
|
56
|
+
"version": "16.5.3-dev.0"
|
|
57
57
|
}
|
|
58
58
|
]
|
|
59
59
|
},
|
|
@@ -1,96 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import * as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import { InjectionToken, Provider } from "@angular/core";
|
|
6
|
+
import { ActivatedRouteSnapshot, Router, RouterStateSnapshot, UrlTree } from "@angular/router";
|
|
7
|
+
import { BehaviorSubject, Observable, ReplaySubject } from "rxjs";
|
|
8
|
+
import { HttpEvent, HttpHandlerFn, HttpRequest } from "@angular/common/http";
|
|
9
|
+
import { Constructor } from "@rxap/utilities";
|
|
10
|
+
export declare class AuthenticationRoutingService {
|
|
11
|
+
private readonly router;
|
|
12
|
+
private readonly authenticationService;
|
|
13
|
+
private readonly deactivated;
|
|
14
|
+
constructor();
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AuthenticationRoutingService, never>;
|
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
isAuthenticated(): Promise<boolean>;
|
|
18
|
+
export interface IAuthenticationService {
|
|
19
|
+
isAuthenticated$: Observable<boolean | null>;
|
|
20
|
+
events$: Observable<AuthenticationEvent>;
|
|
21
|
+
signOut(): Promise<void>;
|
|
22
|
+
isAuthenticated(): Promise<boolean>;
|
|
23
23
|
}
|
|
24
|
-
declare enum AuthenticationEventType {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
export declare enum AuthenticationEventType {
|
|
25
|
+
OnAuthSuccess = "on-auth-success",
|
|
26
|
+
OnAuthError = "on-auth-error",
|
|
27
|
+
OnLogout = "on-logout"
|
|
28
28
|
}
|
|
29
|
-
interface AuthenticationEvent extends Record<string, any> {
|
|
30
|
-
|
|
29
|
+
export interface AuthenticationEvent extends Record<string, any> {
|
|
30
|
+
type: AuthenticationEventType;
|
|
31
31
|
}
|
|
32
|
-
declare class RxapAuthenticationService implements IAuthenticationService {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
export declare class RxapAuthenticationService implements IAuthenticationService {
|
|
33
|
+
isAuthenticated$: BehaviorSubject<boolean | null>;
|
|
34
|
+
readonly events$: ReplaySubject<AuthenticationEvent>;
|
|
35
|
+
private _authenticated;
|
|
36
|
+
constructor();
|
|
37
|
+
signOut(): Promise<void>;
|
|
38
|
+
isAuthenticated(): Promise<boolean>;
|
|
39
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RxapAuthenticationService, never>;
|
|
40
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<RxapAuthenticationGuard>;
|
|
42
|
+
export declare class RxapAuthenticationGuard {
|
|
43
|
+
authentication: RxapAuthenticationService;
|
|
44
|
+
router: Router;
|
|
45
|
+
private readonly deactivated;
|
|
46
|
+
lastUrl: string | null;
|
|
47
|
+
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<UrlTree | boolean>;
|
|
48
|
+
canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<UrlTree | boolean>;
|
|
49
|
+
private checkAuthStatus;
|
|
50
|
+
private createUrlTreeToLastUrl;
|
|
51
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RxapAuthenticationGuard, never>;
|
|
52
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
54
53
|
}
|
|
55
|
-
|
|
56
|
-
declare
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DisabledAuthenticationService, never>;
|
|
64
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<DisabledAuthenticationService>;
|
|
54
|
+
export declare function BearerTokenInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>>;
|
|
55
|
+
export declare class DisabledAuthenticationService implements IAuthenticationService {
|
|
56
|
+
readonly isAuthenticated$: import("rxjs").Observable<boolean>;
|
|
57
|
+
readonly events$: import("rxjs").Observable<never>;
|
|
58
|
+
signOut(): Promise<void>;
|
|
59
|
+
isAuthenticated(): Promise<boolean>;
|
|
60
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DisabledAuthenticationService, never>;
|
|
61
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
65
62
|
}
|
|
66
|
-
|
|
67
|
-
declare function
|
|
68
|
-
declare
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<RegisterService, never>;
|
|
74
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<RegisterService>;
|
|
63
|
+
export declare function provideAuthentication(service: Constructor<IAuthenticationService>, ...additionalProviders: Provider[]): Provider[];
|
|
64
|
+
export declare function withInitialAuthenticationState(state: boolean): Provider;
|
|
65
|
+
export declare class RegisterService {
|
|
66
|
+
constructor();
|
|
67
|
+
register(email: string, password: string): Promise<boolean>;
|
|
68
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RegisterService, never>;
|
|
69
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
75
70
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
71
|
+
export declare class SignOutDirective {
|
|
72
|
+
private readonly auth;
|
|
73
|
+
readonly successful: import("@angular/core").OutputEmitterRef<void>;
|
|
74
|
+
readonly failure: import("@angular/core").OutputEmitterRef<Error>;
|
|
75
|
+
onClick(): Promise<void>;
|
|
76
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SignOutDirective, never>;
|
|
77
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SignOutDirective, "[rxapSignOut]", never, {}, {
|
|
78
|
+
"successful": "successful";
|
|
79
|
+
"failure": "failure";
|
|
80
|
+
}, never, never, true, never>;
|
|
84
81
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
valid?: boolean;
|
|
82
|
+
export declare const RXAP_AUTHENTICATION_DEACTIVATED: InjectionToken<boolean>;
|
|
83
|
+
export interface AuthenticationAccessToken extends Record<string, any> {
|
|
84
|
+
token: string;
|
|
85
|
+
valid?: boolean;
|
|
90
86
|
}
|
|
91
|
-
declare const RXAP_AUTHENTICATION_ACCESS_TOKEN: InjectionToken<BehaviorSubject<AuthenticationAccessToken | null>>;
|
|
92
|
-
declare const RXAP_INITIAL_AUTHENTICATION_STATE: InjectionToken<boolean>;
|
|
93
|
-
declare function withDisabledAuthentication(disabled?: boolean): Provider;
|
|
94
|
-
|
|
95
|
-
export { AuthenticationEventType, AuthenticationRoutingService, BearerTokenInterceptor, DisabledAuthenticationService, RXAP_AUTHENTICATION_ACCESS_TOKEN, RXAP_AUTHENTICATION_DEACTIVATED, RXAP_INITIAL_AUTHENTICATION_STATE, RegisterService, RxapAuthenticationGuard, RxapAuthenticationService, SignOutDirective, provideAuthentication, withDisabledAuthentication, withInitialAuthenticationState };
|
|
96
|
-
export type { AuthenticationAccessToken, AuthenticationEvent, IAuthenticationService };
|
|
87
|
+
export declare const RXAP_AUTHENTICATION_ACCESS_TOKEN: InjectionToken<BehaviorSubject<AuthenticationAccessToken | null>>;
|
|
88
|
+
export declare const RXAP_INITIAL_AUTHENTICATION_STATE: InjectionToken<boolean>;
|
|
89
|
+
export declare function withDisabledAuthentication(disabled?: boolean): Provider;
|