@rxap/oauth 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 +21 -0
- package/compodoc/architecture.html +222 -0
- package/compodoc/changelog.html +65 -5
- package/compodoc/dependencies.html +104 -25
- package/compodoc/index.html +46 -5
- package/compodoc/injectables/AuthenticationService.html +83 -21
- 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 +39 -0
- package/compodoc/miscellaneous/functions.html +59 -15
- package/compodoc/miscellaneous/variables.html +52 -5
- 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 +107 -64
- 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/AuthenticationService.html +134 -8
- package/docs/html/functions/AuthenticationGuard.html +43 -1
- package/docs/html/functions/ProvideAuth.html +42 -1
- package/docs/html/functions/withAuthConfig.html +42 -1
- package/docs/html/hierarchy.html +29 -0
- package/docs/html/index.html +40 -4
- package/docs/html/modules.html +40 -1
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/AuthenticationService.md +13 -13
- package/docs/markdown/functions/AuthenticationGuard.md +2 -2
- package/docs/markdown/functions/ProvideAuth.md +2 -2
- package/docs/markdown/functions/withAuthConfig.md +2 -2
- package/docs/markdown/globals.md +2 -2
- package/docs/wiki/Class.AuthenticationService.md +12 -12
- package/docs/wiki/Function.AuthenticationGuard.md +1 -1
- package/docs/wiki/Function.ProvideAuth.md +1 -1
- package/docs/wiki/Function.withAuthConfig.md +1 -1
- package/docs/wiki/globals.md +1 -1
- package/fesm2022/rxap-oauth.mjs +147 -155
- package/fesm2022/rxap-oauth.mjs.map +1 -1
- package/package.json +18 -18
- package/types/rxap-oauth.d.ts +32 -34
package/fesm2022/rxap-oauth.mjs
CHANGED
|
@@ -1,162 +1,154 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { RXAP_AUTHENTICATION_ACCESS_TOKEN, RXAP_AUTHENTICATION_DEACTIVATED,
|
|
4
|
-
import { isDefined } from
|
|
5
|
-
import {
|
|
6
|
-
import { JwksValidationHandler } from
|
|
7
|
-
import {
|
|
8
|
-
import { map } from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Injectable, inject } from "@angular/core";
|
|
3
|
+
import { AuthenticationEventType, RXAP_AUTHENTICATION_ACCESS_TOKEN, RXAP_AUTHENTICATION_DEACTIVATED, RxapAuthenticationService } from "@rxap/authentication";
|
|
4
|
+
import { isDefined } from "@rxap/rxjs";
|
|
5
|
+
import { AUTH_CONFIG, OAuthService } from "angular-oauth2-oidc";
|
|
6
|
+
import { JwksValidationHandler } from "angular-oauth2-oidc-jwks";
|
|
7
|
+
import { BehaviorSubject, EMPTY, Subject, distinctUntilChanged, firstValueFrom, startWith } from "rxjs";
|
|
8
|
+
import { map } from "rxjs/operators";
|
|
9
|
+
const JONE_DOE_JWT = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
|
|
10
|
+
var AuthenticationService = class AuthenticationService {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.oauthService = inject(OAuthService);
|
|
13
|
+
this.authConfig = inject(AUTH_CONFIG, { optional: true });
|
|
14
|
+
this.authenticationAccessToken = inject(RXAP_AUTHENTICATION_ACCESS_TOKEN);
|
|
15
|
+
this.isAuthDisabled = inject(RXAP_AUTHENTICATION_DEACTIVATED);
|
|
16
|
+
this.events$ = EMPTY;
|
|
17
|
+
this.isAuthenticated$ = new BehaviorSubject(null);
|
|
18
|
+
this._events$ = new Subject();
|
|
19
|
+
if (this.isAuthDisabled) {
|
|
20
|
+
this.events$ = this._events$.asObservable();
|
|
21
|
+
this.linkEventsAndIsAuthenticated();
|
|
22
|
+
this._events$.next({
|
|
23
|
+
type: AuthenticationEventType.OnAuthSuccess,
|
|
24
|
+
payload: null
|
|
25
|
+
});
|
|
26
|
+
this.authenticationAccessToken.next({
|
|
27
|
+
token: JONE_DOE_JWT,
|
|
28
|
+
valid: true
|
|
29
|
+
});
|
|
30
|
+
} else this.init();
|
|
31
|
+
}
|
|
32
|
+
init() {
|
|
33
|
+
if (this.authConfig) this.oauthService.configure(this.authConfig);
|
|
34
|
+
this.events$ = this.oauthService.events.pipe(map((event) => {
|
|
35
|
+
switch (true) {
|
|
36
|
+
case [
|
|
37
|
+
"token_received",
|
|
38
|
+
"token_refreshed",
|
|
39
|
+
"silently_refreshed"
|
|
40
|
+
].includes(event.type):
|
|
41
|
+
this.authenticationAccessToken.next({
|
|
42
|
+
token: this.oauthService.getAccessToken(),
|
|
43
|
+
valid: this.oauthService.hasValidAccessToken()
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
type: AuthenticationEventType.OnAuthSuccess,
|
|
47
|
+
payload: event
|
|
48
|
+
};
|
|
49
|
+
case event.type.endsWith("_error") || ["silent_refresh_timeout", "invalid_nonce_in_state"].includes(event.type):
|
|
50
|
+
this.authenticationAccessToken.next(null);
|
|
51
|
+
return {
|
|
52
|
+
type: AuthenticationEventType.OnAuthError,
|
|
53
|
+
payload: event
|
|
54
|
+
};
|
|
55
|
+
case [
|
|
56
|
+
"token_expires",
|
|
57
|
+
"logout",
|
|
58
|
+
"session_terminated"
|
|
59
|
+
].includes(event.type):
|
|
60
|
+
this.authenticationAccessToken.next(null);
|
|
61
|
+
return {
|
|
62
|
+
type: AuthenticationEventType.OnLogout,
|
|
63
|
+
payload: event
|
|
64
|
+
};
|
|
65
|
+
default:
|
|
66
|
+
console.warn("Unhandled event", event);
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}), isDefined());
|
|
70
|
+
this.linkEventsAndIsAuthenticated();
|
|
71
|
+
this.oauthService.setStorage(sessionStorage);
|
|
72
|
+
if (this.oauthService.silentRefreshRedirectUri) this.oauthService.setupAutomaticSilentRefresh();
|
|
73
|
+
this.oauthService.tokenValidationHandler = new JwksValidationHandler();
|
|
74
|
+
this.oauthService.loadDiscoveryDocumentAndTryLogin().then((status) => {
|
|
75
|
+
this.isAuthenticated$.next(status);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
async signOut() {
|
|
79
|
+
if (this.isAuthDisabled) this._events$.next({
|
|
80
|
+
type: AuthenticationEventType.OnLogout,
|
|
81
|
+
payload: null
|
|
82
|
+
});
|
|
83
|
+
else this.oauthService.logOut();
|
|
84
|
+
}
|
|
85
|
+
signIn() {
|
|
86
|
+
if (this.isAuthDisabled) this._events$.next({
|
|
87
|
+
type: AuthenticationEventType.OnAuthSuccess,
|
|
88
|
+
payload: null
|
|
89
|
+
});
|
|
90
|
+
else this.oauthService.initLoginFlow();
|
|
91
|
+
}
|
|
92
|
+
linkEventsAndIsAuthenticated() {
|
|
93
|
+
this.events$.pipe(map((event) => event ? event.type === AuthenticationEventType.OnAuthSuccess : null), distinctUntilChanged(), startWith(null)).subscribe(this.isAuthenticated$);
|
|
94
|
+
}
|
|
95
|
+
isAuthenticated() {
|
|
96
|
+
return firstValueFrom(this.isAuthenticated$.pipe(isDefined()));
|
|
97
|
+
}
|
|
98
|
+
static {
|
|
99
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
100
|
+
minVersion: "12.0.0",
|
|
101
|
+
version: "22.3.0",
|
|
102
|
+
ngImport: i0,
|
|
103
|
+
type: AuthenticationService,
|
|
104
|
+
deps: [],
|
|
105
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
static {
|
|
109
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
110
|
+
minVersion: "12.0.0",
|
|
111
|
+
version: "22.3.0",
|
|
112
|
+
ngImport: i0,
|
|
113
|
+
type: AuthenticationService
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
118
|
+
minVersion: "12.0.0",
|
|
119
|
+
version: "22.3.0",
|
|
120
|
+
ngImport: i0,
|
|
121
|
+
type: AuthenticationService,
|
|
122
|
+
decorators: [{ type: Injectable }],
|
|
123
|
+
ctorParameters: () => []
|
|
124
|
+
});
|
|
120
125
|
async function AuthenticationGuard(route, state) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (await authService.isAuthenticated()) {
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
authService.signIn();
|
|
134
|
-
return false;
|
|
126
|
+
if (inject(RXAP_AUTHENTICATION_DEACTIVATED, { optional: true }) ?? false) {
|
|
127
|
+
console.warn("Authentication is disabled!");
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
const authService = inject(RxapAuthenticationService);
|
|
131
|
+
if (!(authService instanceof AuthenticationService)) throw new Error("The RxapAuthenticationService must be an instance of AuthenticationService. Ensure the ProvideAuth() function is used in the application config.");
|
|
132
|
+
if (await authService.isAuthenticated()) return true;
|
|
133
|
+
authService.signIn();
|
|
134
|
+
return false;
|
|
135
135
|
}
|
|
136
|
-
|
|
137
136
|
function ProvideAuth(...withConfigs) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
137
|
+
return [
|
|
138
|
+
AuthenticationService,
|
|
139
|
+
{
|
|
140
|
+
provide: RxapAuthenticationService,
|
|
141
|
+
useExisting: AuthenticationService
|
|
142
|
+
},
|
|
143
|
+
...withConfigs.flat()
|
|
144
|
+
];
|
|
146
145
|
}
|
|
147
146
|
function withAuthConfig(config) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
return {
|
|
148
|
+
provide: AUTH_CONFIG,
|
|
149
|
+
useValue: config
|
|
150
|
+
};
|
|
152
151
|
}
|
|
153
|
-
|
|
154
|
-
// region
|
|
155
|
-
// endregion
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Generated bundle index. Do not edit.
|
|
159
|
-
*/
|
|
160
|
-
|
|
161
152
|
export { AuthenticationGuard, AuthenticationService, ProvideAuth, withAuthConfig };
|
|
162
|
-
|
|
153
|
+
|
|
154
|
+
//# sourceMappingURL=rxap-oauth.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rxap-oauth.mjs","sources":["../../../../../packages/angular/oauth/src/lib/authentication.service.ts","../../../../../packages/angular/oauth/src/lib/authentication-guard.ts","../../../../../packages/angular/oauth/src/lib/provide-auth.ts","../../../../../packages/angular/oauth/src/index.ts","../../../../../packages/angular/oauth/src/rxap-oauth.ts"],"sourcesContent":["import { Injectable, inject } from '@angular/core';\nimport {\n AuthenticationAccessToken,\n AuthenticationEvent,\n AuthenticationEventType,\n IAuthenticationService,\n RXAP_AUTHENTICATION_ACCESS_TOKEN,\n RXAP_AUTHENTICATION_DEACTIVATED,\n} from '@rxap/authentication';\nimport { isDefined } from '@rxap/rxjs';\nimport {\n AUTH_CONFIG,\n AuthConfig,\n OAuthService,\n} from 'angular-oauth2-oidc';\nimport { JwksValidationHandler } from 'angular-oauth2-oidc-jwks';\nimport {\n BehaviorSubject,\n distinctUntilChanged,\n EMPTY,\n firstValueFrom,\n Observable,\n startWith,\n Subject,\n} from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nconst JONE_DOE_JWT = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';\n\n@Injectable()\nexport class AuthenticationService implements IAuthenticationService {\n private readonly oauthService = inject(OAuthService);\n private readonly authConfig = inject<AuthConfig>(AUTH_CONFIG, { optional: true });\n private readonly authenticationAccessToken = inject<BehaviorSubject<AuthenticationAccessToken | null>>(RXAP_AUTHENTICATION_ACCESS_TOKEN);\n private readonly isAuthDisabled = inject(RXAP_AUTHENTICATION_DEACTIVATED);\n\n events$: Observable<AuthenticationEvent> = EMPTY;\n public readonly isAuthenticated$ = new BehaviorSubject<boolean | null>(null);\n\n /**\n * Is only used when authentication is disabled to emit the events\n * @private\n */\n private readonly _events$ = new Subject<AuthenticationEvent>();\n\n constructor() {\n if (this.isAuthDisabled) {\n this.events$ = this._events$.asObservable();\n this.linkEventsAndIsAuthenticated();\n this._events$.next({\n type: AuthenticationEventType.OnAuthSuccess,\n payload: null,\n });\n this.authenticationAccessToken.next({\n token: JONE_DOE_JWT,\n valid: true,\n });\n } else {\n this.init();\n }\n }\n\n init() {\n if (this.authConfig) {\n this.oauthService.configure(this.authConfig);\n }\n this.events$ = this.oauthService.events.pipe(\n map(event => {\n switch (true) {\n case [ 'token_received', 'token_refreshed', 'silently_refreshed' ].includes(event.type):\n this.authenticationAccessToken.next({\n token: this.oauthService.getAccessToken(),\n valid: this.oauthService.hasValidAccessToken(),\n });\n return {\n type: AuthenticationEventType.OnAuthSuccess,\n payload: event,\n };\n case event.type.endsWith('_error') ||\n [ 'silent_refresh_timeout', 'invalid_nonce_in_state' ].includes(event.type):\n this.authenticationAccessToken.next(null);\n return {\n type: AuthenticationEventType.OnAuthError,\n payload: event,\n };\n case [ 'token_expires', 'logout', 'session_terminated' ].includes(event.type):\n this.authenticationAccessToken.next(null);\n return {\n type: AuthenticationEventType.OnLogout,\n payload: event,\n };\n default:\n console.warn('Unhandled event', event);\n return null;\n }\n }),\n isDefined(),\n );\n this.linkEventsAndIsAuthenticated();\n\n // Use setStorage to use sessionStorage or another implementation of the TS-type Storage\n // instead of localStorage\n this.oauthService.setStorage(sessionStorage);\n\n if (this.oauthService.silentRefreshRedirectUri) {\n this.oauthService.setupAutomaticSilentRefresh();\n }\n\n this.oauthService.tokenValidationHandler = new JwksValidationHandler();\n this.oauthService.loadDiscoveryDocumentAndTryLogin().then(status => {\n this.isAuthenticated$.next(status);\n });\n }\n\n async signOut(): Promise<void> {\n if (this.isAuthDisabled) {\n this._events$.next({\n type: AuthenticationEventType.OnLogout,\n payload: null,\n });\n } else {\n this.oauthService.logOut();\n }\n }\n\n signIn() {\n if (this.isAuthDisabled) {\n this._events$.next({\n type: AuthenticationEventType.OnAuthSuccess,\n payload: null,\n });\n } else {\n this.oauthService.initLoginFlow();\n }\n }\n\n private linkEventsAndIsAuthenticated() {\n this.events$.pipe(\n map(event => event ? event.type === AuthenticationEventType.OnAuthSuccess : null),\n distinctUntilChanged(),\n startWith(null),\n ).subscribe(this.isAuthenticated$);\n }\n\n isAuthenticated(): Promise<boolean> {\n return firstValueFrom(this.isAuthenticated$.pipe(isDefined()));\n }\n\n}\n","import { inject } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n RouterStateSnapshot,\n} from '@angular/router';\nimport {\n RXAP_AUTHENTICATION_DEACTIVATED,\n RxapAuthenticationService,\n} from '@rxap/authentication';\nimport { AuthenticationService } from './authentication.service';\n\nexport async function AuthenticationGuard(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> {\n\n const isAuthDisabled = inject(RXAP_AUTHENTICATION_DEACTIVATED, { optional: true }) ?? false;\n\n if (isAuthDisabled) {\n console.warn('Authentication is disabled!');\n return true;\n }\n\n const authService = inject(RxapAuthenticationService);\n\n if (!(authService instanceof AuthenticationService)) {\n throw new Error(\n 'The RxapAuthenticationService must be an instance of AuthenticationService. Ensure the ProvideAuth() function is used in the application config.');\n }\n\n if (await authService.isAuthenticated()) {\n return true;\n }\n\n authService.signIn();\n return false;\n\n}\n","import { Provider } from '@angular/core';\nimport { RxapAuthenticationService } from '@rxap/authentication';\nimport {\n AUTH_CONFIG,\n AuthConfig,\n} from 'angular-oauth2-oidc';\nimport { AuthenticationService } from './authentication.service';\n\nexport function ProvideAuth(...withConfigs: Array<Provider | Provider[]>): Provider[] {\n return [\n AuthenticationService,\n {\n provide: RxapAuthenticationService,\n useExisting: AuthenticationService,\n },\n ...withConfigs.flat(),\n ];\n}\n\nexport function withAuthConfig(config: AuthConfig): Provider {\n return {\n provide: AUTH_CONFIG,\n useValue: config,\n };\n}\n","// region \nexport * from './lib/authentication-guard';\nexport * from './lib/authentication.service';\nexport * from './lib/provide-auth';\n// endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AA2BA,MAAM,YAAY,GAAG,6JAA6J;MAGrK,qBAAqB,CAAA;AAehC,IAAA,WAAA,GAAA;AAdiB,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QACnC,IAAA,CAAA,UAAU,GAAG,MAAM,CAAa,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAChE,QAAA,IAAA,CAAA,yBAAyB,GAAG,MAAM,CAAoD,gCAAgC,CAAC;AACvH,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,+BAA+B,CAAC;QAEzE,IAAA,CAAA,OAAO,GAAoC,KAAK;AAChC,QAAA,IAAA,CAAA,gBAAgB,GAAG,IAAI,eAAe,CAAiB,IAAI,CAAC;AAE5E;;;AAGG;AACc,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,OAAO,EAAuB;AAG5D,QAAA,IAAI,IAAI,CAAC,cAAc,EAAE;YACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE;YAC3C,IAAI,CAAC,4BAA4B,EAAE;AACnC,YAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;gBACjB,IAAI,EAAE,uBAAuB,CAAC,aAAa;AAC3C,gBAAA,OAAO,EAAE,IAAI;AACd,aAAA,CAAC;AACF,YAAA,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC;AAClC,gBAAA,KAAK,EAAE,YAAY;AACnB,gBAAA,KAAK,EAAE,IAAI;AACZ,aAAA,CAAC;QACJ;aAAO;YACL,IAAI,CAAC,IAAI,EAAE;QACb;IACF;IAEA,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CAAC,IAAI,EAAE;KACtB;AACH;AAEM,SAAU,cAAc,CAAC,MAAkB,EAAA;IAC/C,OAAO;AACL,QAAA,OAAO,EAAE,WAAW;AACpB,QAAA,QAAQ,EAAE,MAAM;KACjB;AACH;;ACxBA;AAIA;;ACJA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"rxap-oauth.mjs","names":[],"sources":["../../../../../packages/angular/oauth/src/lib/authentication.service.ts","../../../../../packages/angular/oauth/src/lib/authentication-guard.ts","../../../../../packages/angular/oauth/src/lib/provide-auth.ts"],"sourcesContent":["import { Injectable, inject } from '@angular/core';\nimport {\n AuthenticationAccessToken,\n AuthenticationEvent,\n AuthenticationEventType,\n IAuthenticationService,\n RXAP_AUTHENTICATION_ACCESS_TOKEN,\n RXAP_AUTHENTICATION_DEACTIVATED,\n} from '@rxap/authentication';\nimport { isDefined } from '@rxap/rxjs';\nimport {\n AUTH_CONFIG,\n AuthConfig,\n OAuthService,\n} from 'angular-oauth2-oidc';\nimport { JwksValidationHandler } from 'angular-oauth2-oidc-jwks';\nimport {\n BehaviorSubject,\n distinctUntilChanged,\n EMPTY,\n firstValueFrom,\n Observable,\n startWith,\n Subject,\n} from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nconst JONE_DOE_JWT = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';\n\n@Injectable()\nexport class AuthenticationService implements IAuthenticationService {\n private readonly oauthService = inject(OAuthService);\n private readonly authConfig = inject<AuthConfig>(AUTH_CONFIG, { optional: true });\n private readonly authenticationAccessToken = inject<BehaviorSubject<AuthenticationAccessToken | null>>(RXAP_AUTHENTICATION_ACCESS_TOKEN);\n private readonly isAuthDisabled = inject(RXAP_AUTHENTICATION_DEACTIVATED);\n\n events$: Observable<AuthenticationEvent> = EMPTY;\n public readonly isAuthenticated$ = new BehaviorSubject<boolean | null>(null);\n\n /**\n * Is only used when authentication is disabled to emit the events\n * @private\n */\n private readonly _events$ = new Subject<AuthenticationEvent>();\n\n constructor() {\n if (this.isAuthDisabled) {\n this.events$ = this._events$.asObservable();\n this.linkEventsAndIsAuthenticated();\n this._events$.next({\n type: AuthenticationEventType.OnAuthSuccess,\n payload: null,\n });\n this.authenticationAccessToken.next({\n token: JONE_DOE_JWT,\n valid: true,\n });\n } else {\n this.init();\n }\n }\n\n init() {\n if (this.authConfig) {\n this.oauthService.configure(this.authConfig);\n }\n this.events$ = this.oauthService.events.pipe(\n map(event => {\n switch (true) {\n case [ 'token_received', 'token_refreshed', 'silently_refreshed' ].includes(event.type):\n this.authenticationAccessToken.next({\n token: this.oauthService.getAccessToken(),\n valid: this.oauthService.hasValidAccessToken(),\n });\n return {\n type: AuthenticationEventType.OnAuthSuccess,\n payload: event,\n };\n case event.type.endsWith('_error') ||\n [ 'silent_refresh_timeout', 'invalid_nonce_in_state' ].includes(event.type):\n this.authenticationAccessToken.next(null);\n return {\n type: AuthenticationEventType.OnAuthError,\n payload: event,\n };\n case [ 'token_expires', 'logout', 'session_terminated' ].includes(event.type):\n this.authenticationAccessToken.next(null);\n return {\n type: AuthenticationEventType.OnLogout,\n payload: event,\n };\n default:\n console.warn('Unhandled event', event);\n return null;\n }\n }),\n isDefined(),\n );\n this.linkEventsAndIsAuthenticated();\n\n // Use setStorage to use sessionStorage or another implementation of the TS-type Storage\n // instead of localStorage\n this.oauthService.setStorage(sessionStorage);\n\n if (this.oauthService.silentRefreshRedirectUri) {\n this.oauthService.setupAutomaticSilentRefresh();\n }\n\n this.oauthService.tokenValidationHandler = new JwksValidationHandler();\n this.oauthService.loadDiscoveryDocumentAndTryLogin().then(status => {\n this.isAuthenticated$.next(status);\n });\n }\n\n async signOut(): Promise<void> {\n if (this.isAuthDisabled) {\n this._events$.next({\n type: AuthenticationEventType.OnLogout,\n payload: null,\n });\n } else {\n this.oauthService.logOut();\n }\n }\n\n signIn() {\n if (this.isAuthDisabled) {\n this._events$.next({\n type: AuthenticationEventType.OnAuthSuccess,\n payload: null,\n });\n } else {\n this.oauthService.initLoginFlow();\n }\n }\n\n private linkEventsAndIsAuthenticated() {\n this.events$.pipe(\n map(event => event ? event.type === AuthenticationEventType.OnAuthSuccess : null),\n distinctUntilChanged(),\n startWith(null),\n ).subscribe(this.isAuthenticated$);\n }\n\n isAuthenticated(): Promise<boolean> {\n return firstValueFrom(this.isAuthenticated$.pipe(isDefined()));\n }\n\n}\n","import { inject } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n RouterStateSnapshot,\n} from '@angular/router';\nimport {\n RXAP_AUTHENTICATION_DEACTIVATED,\n RxapAuthenticationService,\n} from '@rxap/authentication';\nimport { AuthenticationService } from './authentication.service';\n\nexport async function AuthenticationGuard(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> {\n\n const isAuthDisabled = inject(RXAP_AUTHENTICATION_DEACTIVATED, { optional: true }) ?? false;\n\n if (isAuthDisabled) {\n console.warn('Authentication is disabled!');\n return true;\n }\n\n const authService = inject(RxapAuthenticationService);\n\n if (!(authService instanceof AuthenticationService)) {\n throw new Error(\n 'The RxapAuthenticationService must be an instance of AuthenticationService. Ensure the ProvideAuth() function is used in the application config.');\n }\n\n if (await authService.isAuthenticated()) {\n return true;\n }\n\n authService.signIn();\n return false;\n\n}\n","import { Provider } from '@angular/core';\nimport { RxapAuthenticationService } from '@rxap/authentication';\nimport {\n AUTH_CONFIG,\n AuthConfig,\n} from 'angular-oauth2-oidc';\nimport { AuthenticationService } from './authentication.service';\n\nexport function ProvideAuth(...withConfigs: Array<Provider | Provider[]>): Provider[] {\n return [\n AuthenticationService,\n {\n provide: RxapAuthenticationService,\n useExisting: AuthenticationService,\n },\n ...withConfigs.flat(),\n ];\n}\n\nexport function withAuthConfig(config: AuthConfig): Provider {\n return {\n provide: AUTH_CONFIG,\n useValue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,W;;;AClBD,eAAsB,oBAAoB,OAA+B,OAA0B;CAIjG,IAFuB,OAAO,iCAAiC,EAAE,UAAU,KAAI,CAAE,KAAK,OAElE;EAClB,QAAQ,KAAK,6BAA6B;EAC1C,OAAO;CACT;CAEA,MAAM,cAAc,OAAO,yBAAyB;CAEpD,IAAI,EAAE,uBAAuB,wBAC3B,MAAM,IAAI,MACR,kJAAkJ;CAGtJ,IAAI,MAAM,YAAY,gBAAe,GACnC,OAAO;CAGT,YAAY,OAAM;CAClB,OAAO;AAET;AC1BA,SAAgB,YAAY,GAAG,aAAyC;CACtE,OAAO;EACL;EACA;GACE,SAAS;GACT,aAAa;EACd;EACD,GAAG,YAAY,KAAI;CACpB;AACH;AAEA,SAAgB,eAAe,QAAkB;CAC/C,OAAO;EACL,SAAS;EACT,UAAU;CACX;AACH"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "22.0.0-dev.1",
|
|
3
3
|
"name": "@rxap/oauth",
|
|
4
4
|
"description": "This package provides an authentication guard and service for Angular applications using OAuth 2.0 and OpenID Connect. It simplifies the integration of authentication flows, including sign-in, sign-out, and token management, with support for disabled authentication scenarios. The package also includes a provider function to streamline configuration.\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/core": "^
|
|
12
|
-
"@angular/router": "^
|
|
13
|
-
"@rxap/authentication": "^
|
|
14
|
-
"@rxap/rxjs": "^1.1.
|
|
15
|
-
"angular-oauth2-oidc": "^
|
|
16
|
-
"angular-oauth2-oidc-jwks": "^
|
|
17
|
-
"rxjs": "^7.
|
|
11
|
+
"@angular/core": "^22.0.0",
|
|
12
|
+
"@angular/router": "^22.0.0",
|
|
13
|
+
"@rxap/authentication": "^22.0.0-dev.1",
|
|
14
|
+
"@rxap/rxjs": "^1.1.19-dev.0",
|
|
15
|
+
"angular-oauth2-oidc": "^22.0.0",
|
|
16
|
+
"angular-oauth2-oidc-jwks": "^22.0.0",
|
|
17
|
+
"rxjs": "^7.0.0"
|
|
18
18
|
},
|
|
19
19
|
"author": {
|
|
20
20
|
"name": "Merzough Münker",
|
|
@@ -39,35 +39,35 @@
|
|
|
39
39
|
"packageGroup": [
|
|
40
40
|
{
|
|
41
41
|
"package": "@angular/common",
|
|
42
|
-
"version": "
|
|
42
|
+
"version": "22.3.0"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
"package": "@angular/compiler",
|
|
46
|
-
"version": "
|
|
46
|
+
"version": "22.3.0"
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
49
|
"package": "@angular/core",
|
|
50
|
-
"version": "
|
|
50
|
+
"version": "22.3.0"
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
"package": "@angular/platform-browser",
|
|
54
|
-
"version": "
|
|
54
|
+
"version": "22.3.0"
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
"package": "@angular/router",
|
|
58
|
-
"version": "
|
|
58
|
+
"version": "22.3.0"
|
|
59
59
|
},
|
|
60
60
|
{
|
|
61
61
|
"package": "@rxap/authentication",
|
|
62
|
-
"version": "
|
|
62
|
+
"version": "22.0.0-dev.1"
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
"package": "@rxap/rxjs",
|
|
66
|
-
"version": "1.1.
|
|
66
|
+
"version": "1.1.19-dev.0"
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
"package": "@rxap/utilities",
|
|
70
|
-
"version": "16.5.
|
|
70
|
+
"version": "16.5.3-dev.0"
|
|
71
71
|
}
|
|
72
72
|
]
|
|
73
73
|
},
|
package/types/rxap-oauth.d.ts
CHANGED
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
declare
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
import { ActivatedRouteSnapshot, RouterStateSnapshot } from "@angular/router";
|
|
5
|
+
import { AuthenticationEvent, IAuthenticationService } from "@rxap/authentication";
|
|
6
|
+
import { BehaviorSubject, Observable } from "rxjs";
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
import { Provider } from "@angular/core";
|
|
9
|
+
import { AuthConfig } from "angular-oauth2-oidc";
|
|
10
|
+
export declare function AuthenticationGuard(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean>;
|
|
11
|
+
export declare class AuthenticationService implements IAuthenticationService {
|
|
12
|
+
private readonly oauthService;
|
|
13
|
+
private readonly authConfig;
|
|
14
|
+
private readonly authenticationAccessToken;
|
|
15
|
+
private readonly isAuthDisabled;
|
|
16
|
+
events$: Observable<AuthenticationEvent>;
|
|
17
|
+
readonly isAuthenticated$: BehaviorSubject<boolean | null>;
|
|
18
|
+
/**
|
|
19
|
+
* Is only used when authentication is disabled to emit the events
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
private readonly _events$;
|
|
23
|
+
constructor();
|
|
24
|
+
init(): void;
|
|
25
|
+
signOut(): Promise<void>;
|
|
26
|
+
signIn(): void;
|
|
27
|
+
private linkEventsAndIsAuthenticated;
|
|
28
|
+
isAuthenticated(): Promise<boolean>;
|
|
29
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AuthenticationService, never>;
|
|
30
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
-
declare function
|
|
33
|
-
declare function withAuthConfig(config: AuthConfig): Provider;
|
|
34
|
-
|
|
35
|
-
export { AuthenticationGuard, AuthenticationService, ProvideAuth, withAuthConfig };
|
|
32
|
+
export declare function ProvideAuth(...withConfigs: Array<Provider | Provider[]>): Provider[];
|
|
33
|
+
export declare function withAuthConfig(config: AuthConfig): Provider;
|