@rxap/authentication 21.0.1-dev.0 → 21.0.1-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 +6 -0
- package/compodoc/changelog.html +5 -0
- package/compodoc/dependencies.html +1 -1
- package/compodoc/directives/SignOutDirective.html +80 -163
- package/compodoc/injectables/AuthenticationRoutingService.html +10 -70
- package/compodoc/injectables/RxapAuthenticationGuard.html +13 -124
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/properties.html +1 -1
- package/docs/documentation.json +330 -525
- package/docs/html/assets/hierarchy.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/classes/AuthenticationRoutingService.html +2 -2
- package/docs/html/classes/DisabledAuthenticationService.html +2 -2
- package/docs/html/classes/RegisterService.html +2 -2
- package/docs/html/classes/RxapAuthenticationGuard.html +2 -2
- package/docs/html/classes/RxapAuthenticationService.html +2 -2
- package/docs/html/classes/SignOutDirective.html +2 -2
- package/docs/html/enums/AuthenticationEventType.html +2 -2
- package/docs/html/functions/BearerTokenInterceptor.html +1 -1
- package/docs/html/functions/provideAuthentication.html +1 -1
- package/docs/html/functions/withDisabledAuthentication.html +1 -1
- package/docs/html/functions/withInitialAuthenticationState.html +1 -1
- package/docs/html/hierarchy.html +1 -1
- package/docs/html/index.html +2 -2
- package/docs/html/interfaces/AuthenticationAccessToken.html +2 -2
- package/docs/html/interfaces/AuthenticationEvent.html +2 -2
- package/docs/html/interfaces/IAuthenticationService.html +2 -2
- package/docs/html/modules.html +1 -1
- package/docs/html/variables/RXAP_AUTHENTICATION_ACCESS_TOKEN.html +1 -1
- package/docs/html/variables/RXAP_AUTHENTICATION_DEACTIVATED.html +1 -1
- package/docs/html/variables/RXAP_INITIAL_AUTHENTICATION_STATE.html +1 -1
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/AuthenticationRoutingService.md +4 -18
- package/docs/markdown/classes/DisabledAuthenticationService.md +6 -6
- package/docs/markdown/classes/RegisterService.md +4 -4
- package/docs/markdown/classes/RxapAuthenticationGuard.md +8 -24
- package/docs/markdown/classes/RxapAuthenticationService.md +7 -7
- package/docs/markdown/classes/SignOutDirective.md +8 -16
- 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 +2 -2
- package/docs/markdown/functions/withInitialAuthenticationState.md +2 -2
- package/docs/markdown/globals.md +2 -2
- package/docs/markdown/interfaces/AuthenticationAccessToken.md +4 -4
- package/docs/markdown/interfaces/AuthenticationEvent.md +3 -3
- package/docs/markdown/interfaces/IAuthenticationService.md +6 -6
- package/docs/markdown/variables/RXAP_AUTHENTICATION_ACCESS_TOKEN.md +2 -2
- 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 +3 -17
- package/docs/wiki/Class.DisabledAuthenticationService.md +5 -5
- package/docs/wiki/Class.RegisterService.md +3 -3
- package/docs/wiki/Class.RxapAuthenticationGuard.md +7 -23
- package/docs/wiki/Class.RxapAuthenticationService.md +6 -6
- package/docs/wiki/Class.SignOutDirective.md +7 -15
- 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 +1 -1
- package/docs/wiki/Function.withInitialAuthenticationState.md +1 -1
- package/docs/wiki/Interface.AuthenticationAccessToken.md +3 -3
- package/docs/wiki/Interface.AuthenticationEvent.md +2 -2
- package/docs/wiki/Interface.IAuthenticationService.md +5 -5
- package/docs/wiki/Variable.RXAP_AUTHENTICATION_ACCESS_TOKEN.md +1 -1
- 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 +23 -49
- package/fesm2022/rxap-authentication.mjs.map +1 -1
- package/package.json +3 -3
- package/types/rxap-authentication.d.ts +14 -16
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, Injectable,
|
|
3
|
-
import * as i1 from '@angular/router';
|
|
2
|
+
import { InjectionToken, inject, Injectable, output, Directive } from '@angular/core';
|
|
4
3
|
import { Router } from '@angular/router';
|
|
5
4
|
import { BehaviorSubject, ReplaySubject, take, switchMap, of, EMPTY } from 'rxjs';
|
|
6
5
|
import { tap } from 'rxjs/operators';
|
|
@@ -51,10 +50,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
51
50
|
}], ctorParameters: () => [] });
|
|
52
51
|
|
|
53
52
|
class AuthenticationRoutingService {
|
|
54
|
-
constructor(
|
|
55
|
-
this.router =
|
|
56
|
-
this.authenticationService =
|
|
57
|
-
this.deactivated =
|
|
53
|
+
constructor() {
|
|
54
|
+
this.router = inject(Router);
|
|
55
|
+
this.authenticationService = inject(RxapAuthenticationService);
|
|
56
|
+
this.deactivated = inject(RXAP_AUTHENTICATION_DEACTIVATED, { optional: true }) ?? null;
|
|
57
|
+
const deactivated = this.deactivated;
|
|
58
58
|
if (!deactivated) {
|
|
59
59
|
console.log('Authentication is enabled');
|
|
60
60
|
this.authenticationService.isAuthenticated$.pipe(tap(isAuthenticated => {
|
|
@@ -67,7 +67,7 @@ class AuthenticationRoutingService {
|
|
|
67
67
|
})).subscribe();
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AuthenticationRoutingService, deps: [
|
|
70
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AuthenticationRoutingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
71
71
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AuthenticationRoutingService, providedIn: 'root' }); }
|
|
72
72
|
}
|
|
73
73
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AuthenticationRoutingService, decorators: [{
|
|
@@ -75,24 +75,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
75
75
|
args: [{
|
|
76
76
|
providedIn: 'root',
|
|
77
77
|
}]
|
|
78
|
-
}], ctorParameters: () => [
|
|
79
|
-
type: Inject,
|
|
80
|
-
args: [Router]
|
|
81
|
-
}] }, { type: RxapAuthenticationService, decorators: [{
|
|
82
|
-
type: Inject,
|
|
83
|
-
args: [RxapAuthenticationService]
|
|
84
|
-
}] }, { type: undefined, decorators: [{
|
|
85
|
-
type: Optional
|
|
86
|
-
}, {
|
|
87
|
-
type: Inject,
|
|
88
|
-
args: [RXAP_AUTHENTICATION_DEACTIVATED]
|
|
89
|
-
}] }] });
|
|
78
|
+
}], ctorParameters: () => [] });
|
|
90
79
|
|
|
91
80
|
class RxapAuthenticationGuard {
|
|
92
|
-
constructor(
|
|
93
|
-
this.authentication =
|
|
94
|
-
this.router =
|
|
95
|
-
this.deactivated =
|
|
81
|
+
constructor() {
|
|
82
|
+
this.authentication = inject(RxapAuthenticationService);
|
|
83
|
+
this.router = inject(Router);
|
|
84
|
+
this.deactivated = inject(RXAP_AUTHENTICATION_DEACTIVATED, { optional: true }) ?? null;
|
|
96
85
|
this.lastUrl = null;
|
|
97
86
|
}
|
|
98
87
|
canActivate(route, state) {
|
|
@@ -172,24 +161,13 @@ class RxapAuthenticationGuard {
|
|
|
172
161
|
}
|
|
173
162
|
return this.router.createUrlTree([lastUrl]);
|
|
174
163
|
}
|
|
175
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RxapAuthenticationGuard, deps: [
|
|
164
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RxapAuthenticationGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
176
165
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RxapAuthenticationGuard, providedIn: 'root' }); }
|
|
177
166
|
}
|
|
178
167
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RxapAuthenticationGuard, decorators: [{
|
|
179
168
|
type: Injectable,
|
|
180
169
|
args: [{ providedIn: 'root' }]
|
|
181
|
-
}]
|
|
182
|
-
type: Inject,
|
|
183
|
-
args: [RxapAuthenticationService]
|
|
184
|
-
}] }, { type: i1.Router, decorators: [{
|
|
185
|
-
type: Inject,
|
|
186
|
-
args: [Router]
|
|
187
|
-
}] }, { type: undefined, decorators: [{
|
|
188
|
-
type: Optional
|
|
189
|
-
}, {
|
|
190
|
-
type: Inject,
|
|
191
|
-
args: [RXAP_AUTHENTICATION_DEACTIVATED]
|
|
192
|
-
}] }] });
|
|
170
|
+
}] });
|
|
193
171
|
|
|
194
172
|
function BearerTokenInterceptor(req, next) {
|
|
195
173
|
const accessToken$ = inject(RXAP_AUTHENTICATION_ACCESS_TOKEN);
|
|
@@ -266,10 +244,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
266
244
|
}], ctorParameters: () => [] });
|
|
267
245
|
|
|
268
246
|
class SignOutDirective {
|
|
269
|
-
constructor(
|
|
270
|
-
this.auth =
|
|
271
|
-
this.successful =
|
|
272
|
-
this.failure =
|
|
247
|
+
constructor() {
|
|
248
|
+
this.auth = inject(RxapAuthenticationService);
|
|
249
|
+
this.successful = output();
|
|
250
|
+
this.failure = output();
|
|
273
251
|
}
|
|
274
252
|
async onClick() {
|
|
275
253
|
try {
|
|
@@ -280,7 +258,7 @@ class SignOutDirective {
|
|
|
280
258
|
this.failure.emit(e);
|
|
281
259
|
}
|
|
282
260
|
}
|
|
283
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: SignOutDirective, deps: [
|
|
261
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: SignOutDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
284
262
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: SignOutDirective, isStandalone: true, selector: "[rxapSignOut]", outputs: { successful: "successful", failure: "failure" }, host: { listeners: { "click": "onClick()" } }, ngImport: i0 }); }
|
|
285
263
|
}
|
|
286
264
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: SignOutDirective, decorators: [{
|
|
@@ -288,15 +266,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
288
266
|
args: [{
|
|
289
267
|
selector: '[rxapSignOut]',
|
|
290
268
|
standalone: true,
|
|
269
|
+
host: {
|
|
270
|
+
'(click)': 'onClick()',
|
|
271
|
+
},
|
|
291
272
|
}]
|
|
292
|
-
}],
|
|
293
|
-
type: Output
|
|
294
|
-
}], failure: [{
|
|
295
|
-
type: Output
|
|
296
|
-
}], onClick: [{
|
|
297
|
-
type: HostListener,
|
|
298
|
-
args: ['click']
|
|
299
|
-
}] } });
|
|
273
|
+
}], propDecorators: { successful: [{ type: i0.Output, args: ["successful"] }], failure: [{ type: i0.Output, args: ["failure"] }] } });
|
|
300
274
|
|
|
301
275
|
// region
|
|
302
276
|
// endregion
|
|
@@ -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 {\n Inject,\n Injectable,\n Optional,\n} 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\n constructor(\n @Inject(Router)\n private readonly router: Router,\n @Inject(RxapAuthenticationService)\n private readonly authenticationService: RxapAuthenticationService,\n @Optional()\n @Inject(RXAP_AUTHENTICATION_DEACTIVATED)\n private readonly deactivated: boolean | null = null,\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 {\n Inject,\n Injectable,\n Optional,\n} 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\n public lastUrl: string | null = null;\n\n constructor(\n @Inject(RxapAuthenticationService)\n public authentication: RxapAuthenticationService,\n @Inject(Router)\n public router: Router,\n @Optional()\n @Inject(RXAP_AUTHENTICATION_DEACTIVATED)\n private readonly deactivated: boolean | null = null,\n ) {\n }\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 {\n Directive,\n EventEmitter,\n HostListener,\n Output,\n} from '@angular/core';\nimport { RxapAuthenticationService } from './authentication.service';\n\n@Directive({\n selector: '[rxapSignOut]',\n standalone: true,\n})\nexport class SignOutDirective {\n\n @Output()\n public successful = new EventEmitter<void>();\n\n @Output()\n public failure = new EventEmitter<Error>();\n\n constructor(private readonly auth: RxapAuthenticationService) {\n }\n\n @HostListener('click')\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":["i1.RxapAuthenticationService"],"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,CAAC;AAGhE,QAAA,IAAI,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC7F;AAEO,IAAA,MAAM,OAA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A;;AAEG;;;;"}
|
|
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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A,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;;;;"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "21.0.1-dev.
|
|
2
|
+
"version": "21.0.1-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",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"@angular/common": "^21.2.9",
|
|
12
12
|
"@angular/core": "^21.2.9",
|
|
13
13
|
"@angular/router": "^21.2.9",
|
|
14
|
-
"@rxap/utilities": "^16.5.2-dev.
|
|
14
|
+
"@rxap/utilities": "^16.5.2-dev.1",
|
|
15
15
|
"rxjs": "^7.8.2"
|
|
16
16
|
},
|
|
17
17
|
"author": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
"package": "@rxap/utilities",
|
|
56
|
-
"version": "16.5.2-dev.
|
|
56
|
+
"version": "16.5.2-dev.1"
|
|
57
57
|
}
|
|
58
58
|
]
|
|
59
59
|
},
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Provider, InjectionToken } from '@angular/core';
|
|
1
3
|
import { Router, ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree } from '@angular/router';
|
|
2
4
|
import * as rxjs from 'rxjs';
|
|
3
5
|
import { Observable, BehaviorSubject, ReplaySubject } from 'rxjs';
|
|
4
|
-
import * as i0 from '@angular/core';
|
|
5
|
-
import { Provider, EventEmitter, InjectionToken } from '@angular/core';
|
|
6
6
|
import { HttpRequest, HttpHandlerFn, HttpEvent } from '@angular/common/http';
|
|
7
7
|
import { Constructor } from '@rxap/utilities';
|
|
8
8
|
|
|
9
|
+
declare class AuthenticationRoutingService {
|
|
10
|
+
private readonly router;
|
|
11
|
+
private readonly authenticationService;
|
|
12
|
+
private readonly deactivated;
|
|
13
|
+
constructor();
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AuthenticationRoutingService, never>;
|
|
15
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AuthenticationRoutingService>;
|
|
16
|
+
}
|
|
17
|
+
|
|
9
18
|
interface IAuthenticationService {
|
|
10
19
|
isAuthenticated$: Observable<boolean | null>;
|
|
11
20
|
events$: Observable<AuthenticationEvent>;
|
|
@@ -31,26 +40,16 @@ declare class RxapAuthenticationService implements IAuthenticationService {
|
|
|
31
40
|
static ɵprov: i0.ɵɵInjectableDeclaration<RxapAuthenticationService>;
|
|
32
41
|
}
|
|
33
42
|
|
|
34
|
-
declare class AuthenticationRoutingService {
|
|
35
|
-
private readonly router;
|
|
36
|
-
private readonly authenticationService;
|
|
37
|
-
private readonly deactivated;
|
|
38
|
-
constructor(router: Router, authenticationService: RxapAuthenticationService, deactivated?: boolean | null);
|
|
39
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AuthenticationRoutingService, [null, null, { optional: true; }]>;
|
|
40
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<AuthenticationRoutingService>;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
43
|
declare class RxapAuthenticationGuard {
|
|
44
44
|
authentication: RxapAuthenticationService;
|
|
45
45
|
router: Router;
|
|
46
46
|
private readonly deactivated;
|
|
47
47
|
lastUrl: string | null;
|
|
48
|
-
constructor(authentication: RxapAuthenticationService, router: Router, deactivated?: boolean | null);
|
|
49
48
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<UrlTree | boolean>;
|
|
50
49
|
canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<UrlTree | boolean>;
|
|
51
50
|
private checkAuthStatus;
|
|
52
51
|
private createUrlTreeToLastUrl;
|
|
53
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<RxapAuthenticationGuard,
|
|
52
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RxapAuthenticationGuard, never>;
|
|
54
53
|
static ɵprov: i0.ɵɵInjectableDeclaration<RxapAuthenticationGuard>;
|
|
55
54
|
}
|
|
56
55
|
|
|
@@ -77,9 +76,8 @@ declare class RegisterService {
|
|
|
77
76
|
|
|
78
77
|
declare class SignOutDirective {
|
|
79
78
|
private readonly auth;
|
|
80
|
-
successful:
|
|
81
|
-
failure:
|
|
82
|
-
constructor(auth: RxapAuthenticationService);
|
|
79
|
+
readonly successful: i0.OutputEmitterRef<void>;
|
|
80
|
+
readonly failure: i0.OutputEmitterRef<Error>;
|
|
83
81
|
onClick(): Promise<void>;
|
|
84
82
|
static ɵfac: i0.ɵɵFactoryDeclaration<SignOutDirective, never>;
|
|
85
83
|
static ɵdir: i0.ɵɵDirectiveDeclaration<SignOutDirective, "[rxapSignOut]", never, {}, { "successful": "successful"; "failure": "failure"; }, never, never, true, never>;
|