@bcweed/authentication-lib 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -14
- package/fesm2022/bcweed-authentication-lib.mjs +501 -0
- package/fesm2022/bcweed-authentication-lib.mjs.map +1 -0
- package/index.d.ts +169 -0
- package/package.json +45 -61
- package/.editorconfig +0 -17
- package/AngularAuthenticationLibrary.esproj +0 -10
- package/CHANGELOG.md +0 -16
- package/angular.json +0 -66
- package/obj/Debug/AngularAuthenticationLibrary.esproj.CoreCompileInputs.cache +0 -0
- package/obj/Debug/AngularAuthenticationLibrary.esproj.FileListAbsolute.txt +0 -1
- package/obj/Debug/package.g.props +0 -52
- package/projects/authentication-lib/README.md +0 -63
- package/projects/authentication-lib/ng-package.json +0 -7
- package/projects/authentication-lib/package.json +0 -27
- package/projects/authentication-lib/src/lib/auth-callback/auth-callback.component.html +0 -1
- package/projects/authentication-lib/src/lib/auth-callback/auth-callback.component.scss +0 -0
- package/projects/authentication-lib/src/lib/auth-callback/auth-callback.component.spec.ts +0 -23
- package/projects/authentication-lib/src/lib/auth-callback/auth-callback.component.ts +0 -68
- package/projects/authentication-lib/src/lib/auth.service.spec.ts +0 -16
- package/projects/authentication-lib/src/lib/auth.service.ts +0 -213
- package/projects/authentication-lib/src/lib/authentication-error/authentication-error.component.html +0 -7
- package/projects/authentication-lib/src/lib/authentication-error/authentication-error.component.scss +0 -0
- package/projects/authentication-lib/src/lib/authentication-error/authentication-error.component.spec.ts +0 -23
- package/projects/authentication-lib/src/lib/authentication-error/authentication-error.component.ts +0 -32
- package/projects/authentication-lib/src/lib/authentication-lib.module.ts +0 -26
- package/projects/authentication-lib/src/lib/authentication-lib.tokens.ts +0 -4
- package/projects/authentication-lib/src/lib/login/login.component.html +0 -1
- package/projects/authentication-lib/src/lib/login/login.component.scss +0 -0
- package/projects/authentication-lib/src/lib/login/login.component.spec.ts +0 -23
- package/projects/authentication-lib/src/lib/login/login.component.ts +0 -28
- package/projects/authentication-lib/src/lib/login-menu/login-menu.component.html +0 -39
- package/projects/authentication-lib/src/lib/login-menu/login-menu.component.scss +0 -7
- package/projects/authentication-lib/src/lib/login-menu/login-menu.component.spec.ts +0 -23
- package/projects/authentication-lib/src/lib/login-menu/login-menu.component.ts +0 -51
- package/projects/authentication-lib/src/lib/logout/logout.component.html +0 -1
- package/projects/authentication-lib/src/lib/logout/logout.component.scss +0 -0
- package/projects/authentication-lib/src/lib/logout/logout.component.spec.ts +0 -23
- package/projects/authentication-lib/src/lib/logout/logout.component.ts +0 -29
- package/projects/authentication-lib/src/lib/logout-callback/logout-callback.component.html +0 -0
- package/projects/authentication-lib/src/lib/logout-callback/logout-callback.component.scss +0 -0
- package/projects/authentication-lib/src/lib/logout-callback/logout-callback.component.spec.ts +0 -23
- package/projects/authentication-lib/src/lib/logout-callback/logout-callback.component.ts +0 -27
- package/projects/authentication-lib/src/lib/route-history.service.spec.ts +0 -16
- package/projects/authentication-lib/src/lib/route-history.service.ts +0 -31
- package/projects/authentication-lib/src/public-api.ts +0 -14
- package/projects/authentication-lib/tsconfig.lib.json +0 -15
- package/projects/authentication-lib/tsconfig.lib.prod.json +0 -11
- package/projects/authentication-lib/tsconfig.spec.json +0 -15
- package/tsconfig.json +0 -32
package/index.d.ts
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import * as i2 from '@angular/router';
|
|
2
|
+
import { Router, ActivatedRoute } from '@angular/router';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { InjectionToken, OnInit } from '@angular/core';
|
|
5
|
+
import { AuthConfig, OAuthService, OAuthEvent } from 'angular-oauth2-oidc';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
import * as i1 from '@angular/common';
|
|
8
|
+
import { BreakpointObserver } from '@angular/cdk/layout';
|
|
9
|
+
import { MenuItem } from 'primeng/api';
|
|
10
|
+
|
|
11
|
+
declare class RouteHistoryService {
|
|
12
|
+
private router;
|
|
13
|
+
private activatedRoute;
|
|
14
|
+
private previousUrl;
|
|
15
|
+
private currentUrl;
|
|
16
|
+
constructor(router: Router, activatedRoute: ActivatedRoute);
|
|
17
|
+
init(): void;
|
|
18
|
+
getPreviousUrl(): string | null;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RouteHistoryService, never>;
|
|
20
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<RouteHistoryService>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface UserProfile {
|
|
24
|
+
sub: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
email?: string;
|
|
27
|
+
preferred_username?: string;
|
|
28
|
+
given_name?: string;
|
|
29
|
+
family_name?: string;
|
|
30
|
+
fax?: string;
|
|
31
|
+
address?: string;
|
|
32
|
+
address2?: string;
|
|
33
|
+
city?: string;
|
|
34
|
+
region?: string;
|
|
35
|
+
country?: string;
|
|
36
|
+
phone_number?: string;
|
|
37
|
+
postal_code?: string;
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
}
|
|
40
|
+
declare class AuthService {
|
|
41
|
+
private readonly authConfig;
|
|
42
|
+
private oauthService;
|
|
43
|
+
private router;
|
|
44
|
+
private platformId;
|
|
45
|
+
constructor(authConfig: AuthConfig, oauthService: OAuthService, router: Router, platformId: object);
|
|
46
|
+
private readonly profile$;
|
|
47
|
+
private profileLoading;
|
|
48
|
+
private profileIsLoaded;
|
|
49
|
+
private isAuthenticatedSubject$;
|
|
50
|
+
isAuthenticated$: Observable<boolean>;
|
|
51
|
+
private isDoneLoadingSubject$;
|
|
52
|
+
isDoneLoading$: Observable<boolean>;
|
|
53
|
+
private eventsSubject$;
|
|
54
|
+
events$: Observable<OAuthEvent>;
|
|
55
|
+
/**
|
|
56
|
+
* Publishes `true` if and only if (a) all the asynchronous initial
|
|
57
|
+
* login calls have completed or errored, and (b) the user ended up
|
|
58
|
+
* being authenticated.
|
|
59
|
+
*
|
|
60
|
+
* In essence, it combines:
|
|
61
|
+
*
|
|
62
|
+
* - the latest known state of whether the user is authorized
|
|
63
|
+
* - whether the ajax calls for initial log in have all been done
|
|
64
|
+
*/
|
|
65
|
+
isLoggedIn$: Observable<boolean>;
|
|
66
|
+
loadConfiguration(authConfig: AuthConfig): void;
|
|
67
|
+
runInitialLoginSequence(): Promise<void>;
|
|
68
|
+
login(returnUrl: string): void;
|
|
69
|
+
logout(): void;
|
|
70
|
+
revokeTokenAndLogout(): void;
|
|
71
|
+
state(): string | undefined;
|
|
72
|
+
hasRole(role: string): boolean;
|
|
73
|
+
refresh(): void;
|
|
74
|
+
hasValidToken(): boolean;
|
|
75
|
+
getFullname(): any;
|
|
76
|
+
get accessToken(): string;
|
|
77
|
+
get identityClaims(): any;
|
|
78
|
+
get isLoggedIn(): boolean;
|
|
79
|
+
get userProfile$(): Observable<UserProfile | null>;
|
|
80
|
+
/** Synchronous getter */
|
|
81
|
+
get snapshot(): UserProfile | null;
|
|
82
|
+
/** Clears profile on logout */
|
|
83
|
+
clearProfile(): void;
|
|
84
|
+
/** Loads user profile from userinfo endpoint */
|
|
85
|
+
loadProfile(): Promise<void>;
|
|
86
|
+
/** Handles OAuth events */
|
|
87
|
+
private handleOAuthEvent;
|
|
88
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, never>;
|
|
89
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AuthService>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
declare const AUTHENTICATION_LIB_CONFIG: InjectionToken<AuthConfig>;
|
|
93
|
+
|
|
94
|
+
declare class AuthenticationLibModule {
|
|
95
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AuthenticationLibModule, never>;
|
|
96
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<AuthenticationLibModule, never, [typeof i1.CommonModule, typeof i2.RouterModule], never>;
|
|
97
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<AuthenticationLibModule>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
declare class AuthCallbackComponent implements OnInit {
|
|
101
|
+
private router;
|
|
102
|
+
private activatedRoute;
|
|
103
|
+
private authService;
|
|
104
|
+
constructor(router: Router, activatedRoute: ActivatedRoute, authService: AuthService);
|
|
105
|
+
ngOnInit(): void;
|
|
106
|
+
private reRouteToError;
|
|
107
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AuthCallbackComponent, never>;
|
|
108
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AuthCallbackComponent, "app-auth-callback", never, {}, {}, never, never, false, never>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare class LoginComponent implements OnInit {
|
|
112
|
+
private activatedRoute;
|
|
113
|
+
private routeHistoryService;
|
|
114
|
+
private authService;
|
|
115
|
+
private platformId;
|
|
116
|
+
constructor(activatedRoute: ActivatedRoute, routeHistoryService: RouteHistoryService, authService: AuthService, platformId: object);
|
|
117
|
+
ngOnInit(): void;
|
|
118
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LoginComponent, never>;
|
|
119
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LoginComponent, "app-login", never, {}, {}, never, never, true, never>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
declare class AuthenticationErrorComponent implements OnInit {
|
|
123
|
+
private activatedRoute;
|
|
124
|
+
constructor(activatedRoute: ActivatedRoute);
|
|
125
|
+
routeParams$: Observable<any> | undefined;
|
|
126
|
+
returnUrl: string | undefined;
|
|
127
|
+
ngOnInit(): void;
|
|
128
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AuthenticationErrorComponent, never>;
|
|
129
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AuthenticationErrorComponent, "app-authentication-error", never, {}, {}, never, never, true, never>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
declare class LoginMenuComponent {
|
|
133
|
+
private responsive;
|
|
134
|
+
private authService;
|
|
135
|
+
isExpanded: boolean;
|
|
136
|
+
isSmallMedia: boolean;
|
|
137
|
+
userRoles: string[];
|
|
138
|
+
items: MenuItem[] | undefined;
|
|
139
|
+
isAuthenticated?: boolean;
|
|
140
|
+
profile$: Observable<UserProfile | null>;
|
|
141
|
+
isAuthenticated$: Observable<boolean | null> | undefined;
|
|
142
|
+
constructor(responsive: BreakpointObserver, authService: AuthService);
|
|
143
|
+
ngOnInit(): void;
|
|
144
|
+
collapse(): void;
|
|
145
|
+
toggle(): void;
|
|
146
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LoginMenuComponent, never>;
|
|
147
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LoginMenuComponent, "app-login-menu", never, {}, {}, never, never, true, never>;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
declare class LogoutComponent implements OnInit {
|
|
151
|
+
private authService;
|
|
152
|
+
private platformId;
|
|
153
|
+
constructor(authService: AuthService, platformId: object);
|
|
154
|
+
ngOnInit(): void;
|
|
155
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LogoutComponent, never>;
|
|
156
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LogoutComponent, "app-logout", never, {}, {}, never, never, true, never>;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
declare class LogoutCallbackComponent implements OnInit {
|
|
160
|
+
private router;
|
|
161
|
+
private platformId;
|
|
162
|
+
constructor(router: Router, platformId: object);
|
|
163
|
+
ngOnInit(): void;
|
|
164
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LogoutCallbackComponent, never>;
|
|
165
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LogoutCallbackComponent, "app-logout-callback", never, {}, {}, never, never, true, never>;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export { AUTHENTICATION_LIB_CONFIG, AuthCallbackComponent, AuthService, AuthenticationErrorComponent, AuthenticationLibModule, LoginComponent, LoginMenuComponent, LogoutCallbackComponent, LogoutComponent, RouteHistoryService };
|
|
169
|
+
export type { UserProfile };
|
package/package.json
CHANGED
|
@@ -1,61 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bcweed/authentication-lib",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"@angular/
|
|
30
|
-
"@angular/
|
|
31
|
-
"@angular/
|
|
32
|
-
"@angular/
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"@angular/
|
|
36
|
-
"@
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@angular/build": "^20.3.20",
|
|
49
|
-
"@angular/cli": "^20.3.20",
|
|
50
|
-
"@angular/compiler-cli": "^20.3.18",
|
|
51
|
-
"@types/jasmine": "~5.1.0",
|
|
52
|
-
"jasmine-core": "~5.6.0",
|
|
53
|
-
"karma": "~6.4.0",
|
|
54
|
-
"karma-chrome-launcher": "~3.2.0",
|
|
55
|
-
"karma-coverage": "~2.2.0",
|
|
56
|
-
"karma-jasmine": "~5.1.0",
|
|
57
|
-
"karma-jasmine-html-reporter": "~2.1.0",
|
|
58
|
-
"ng-packagr": "^20.3.2",
|
|
59
|
-
"typescript": "~5.9.3"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@bcweed/authentication-lib",
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.0.",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"author": "",
|
|
7
|
+
"type": "commonjs",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./package.json": {
|
|
10
|
+
"default": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./index.d.ts",
|
|
14
|
+
"default": "./fesm2022/bcweed-authentication-lib.mjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"main": "public-api.ts",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"tslib": "^2.3.0"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"@angular/animations": "^20.3.18",
|
|
26
|
+
"@angular/cdk": "^20.2.14",
|
|
27
|
+
"@angular/common": "^20.3.18",
|
|
28
|
+
"@angular/compiler": "^20.3.18",
|
|
29
|
+
"@angular/core": "^20.3.18",
|
|
30
|
+
"@angular/forms": "^20.3.18",
|
|
31
|
+
"@angular/platform-browser": "^20.3.18",
|
|
32
|
+
"@angular/platform-browser-dynamic": "^20.3.18",
|
|
33
|
+
"angular-oauth2-oidc": "^20.0.2",
|
|
34
|
+
"angular-oauth2-oidc-jwks": "^20.0.0",
|
|
35
|
+
"@angular/router": "^20.3.18",
|
|
36
|
+
"@primeng/themes": "^21.0.2",
|
|
37
|
+
"primeicons": "^7.0.0",
|
|
38
|
+
"primeng": "^20.4.0",
|
|
39
|
+
"rxjs": "~7.8.0",
|
|
40
|
+
"zone.js": "~0.15.0"
|
|
41
|
+
},
|
|
42
|
+
"sideEffects": false,
|
|
43
|
+
"module": "fesm2022/bcweed-authentication-lib.mjs",
|
|
44
|
+
"typings": "index.d.ts"
|
|
45
|
+
}
|
package/.editorconfig
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Editor configuration, see https://editorconfig.org
|
|
2
|
-
root = true
|
|
3
|
-
|
|
4
|
-
[*]
|
|
5
|
-
charset = utf-8
|
|
6
|
-
indent_style = space
|
|
7
|
-
indent_size = 2
|
|
8
|
-
insert_final_newline = true
|
|
9
|
-
trim_trailing_whitespace = true
|
|
10
|
-
|
|
11
|
-
[*.ts]
|
|
12
|
-
quote_type = single
|
|
13
|
-
ij_typescript_use_double_quotes = false
|
|
14
|
-
|
|
15
|
-
[*.md]
|
|
16
|
-
max_line_length = off
|
|
17
|
-
trim_trailing_whitespace = false
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/1.0.2752196">
|
|
2
|
-
<PropertyGroup>
|
|
3
|
-
<StartupCommand>npm start</StartupCommand>
|
|
4
|
-
<JavaScriptTestFramework>Jasmine</JavaScriptTestFramework>
|
|
5
|
-
<!-- Allows the build (or compile) script located on package.json to run on Build -->
|
|
6
|
-
<ShouldRunBuildScript>false</ShouldRunBuildScript>
|
|
7
|
-
<!-- Folder where production build objects will be placed -->
|
|
8
|
-
<BuildOutputFolder>$(MSBuildProjectDirectory)\dist\AngularAuthenticationLibrary\browser\</BuildOutputFolder>
|
|
9
|
-
</PropertyGroup>
|
|
10
|
-
</Project>
|
package/CHANGELOG.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
This file explains how Visual Studio created the project.
|
|
2
|
-
|
|
3
|
-
The following tools were used to generate this project:
|
|
4
|
-
- Angular CLI (ng)
|
|
5
|
-
|
|
6
|
-
The following steps were used to generate this project:
|
|
7
|
-
- Create Angular project with ng: `ng new AngularAuthenticationLibrary --defaults --skip-install --skip-git --no-standalone `.
|
|
8
|
-
- Update angular.json with port.
|
|
9
|
-
- Create project file (`AngularAuthenticationLibrary.esproj`).
|
|
10
|
-
- Create `launch.json` to enable debugging.
|
|
11
|
-
- Update package.json to add `jest-editor-support`.
|
|
12
|
-
- Update `start` script in `package.json` to specify host.
|
|
13
|
-
- Add `karma.conf.js` for unit tests.
|
|
14
|
-
- Update `angular.json` to point to `karma.conf.js`.
|
|
15
|
-
- Add project to solution.
|
|
16
|
-
- Write this file.
|
package/angular.json
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
3
|
-
"version": 1,
|
|
4
|
-
"newProjectRoot": "projects",
|
|
5
|
-
"projects": {
|
|
6
|
-
"authentication-lib": {
|
|
7
|
-
"projectType": "library",
|
|
8
|
-
"root": "projects/authentication-lib",
|
|
9
|
-
"sourceRoot": "projects/authentication-lib/src",
|
|
10
|
-
"prefix": "lib",
|
|
11
|
-
"architect": {
|
|
12
|
-
"build": {
|
|
13
|
-
"builder": "@angular/build:ng-packagr",
|
|
14
|
-
"options": {
|
|
15
|
-
"project": "projects/authentication-lib/ng-package.json"
|
|
16
|
-
},
|
|
17
|
-
"configurations": {
|
|
18
|
-
"production": {
|
|
19
|
-
"tsConfig": "projects/authentication-lib/tsconfig.lib.prod.json"
|
|
20
|
-
},
|
|
21
|
-
"development": {
|
|
22
|
-
"tsConfig": "projects/authentication-lib/tsconfig.lib.json"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"defaultConfiguration": "production"
|
|
26
|
-
},
|
|
27
|
-
"test": {
|
|
28
|
-
"builder": "@angular/build:karma",
|
|
29
|
-
"options": {
|
|
30
|
-
"tsConfig": "projects/authentication-lib/tsconfig.spec.json",
|
|
31
|
-
"polyfills": [
|
|
32
|
-
"zone.js",
|
|
33
|
-
"zone.js/testing"
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"schematics": {
|
|
41
|
-
"@schematics/angular:component": {
|
|
42
|
-
"type": "component"
|
|
43
|
-
},
|
|
44
|
-
"@schematics/angular:directive": {
|
|
45
|
-
"type": "directive"
|
|
46
|
-
},
|
|
47
|
-
"@schematics/angular:service": {
|
|
48
|
-
"type": "service"
|
|
49
|
-
},
|
|
50
|
-
"@schematics/angular:guard": {
|
|
51
|
-
"typeSeparator": "."
|
|
52
|
-
},
|
|
53
|
-
"@schematics/angular:interceptor": {
|
|
54
|
-
"typeSeparator": "."
|
|
55
|
-
},
|
|
56
|
-
"@schematics/angular:module": {
|
|
57
|
-
"typeSeparator": "."
|
|
58
|
-
},
|
|
59
|
-
"@schematics/angular:pipe": {
|
|
60
|
-
"typeSeparator": "."
|
|
61
|
-
},
|
|
62
|
-
"@schematics/angular:resolver": {
|
|
63
|
-
"typeSeparator": "."
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
E:\work\AngularAuthenticationLibrary\AngularAuthenticationLibrary\obj\Debug\AngularAuthenticationLibrary.esproj.CoreCompileInputs.cache
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<Project>
|
|
3
|
-
<PropertyGroup>
|
|
4
|
-
<PackageJsonName Condition="$(PackageJsonName) == ''">@bcweed/authentication-lib</PackageJsonName>
|
|
5
|
-
<PackageJsonVersion Condition="$(PackageJsonVersion) == ''">0.0.2</PackageJsonVersion>
|
|
6
|
-
<PackageJsonPrivate Condition="$(PackageJsonPrivate) == ''">false</PackageJsonPrivate>
|
|
7
|
-
<PackageJsonPublishconfigAccess Condition="$(PackageJsonPublishconfigAccess) == ''">public</PackageJsonPublishconfigAccess>
|
|
8
|
-
<PackageJsonDescription Condition="$(PackageJsonDescription) == ''">This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.19.</PackageJsonDescription>
|
|
9
|
-
<PackageJsonHomepage Condition="$(PackageJsonHomepage) == ''">https://github.com/cartier966/AngularAuthenticationLibrary#readme</PackageJsonHomepage>
|
|
10
|
-
<PackageJsonBugsUrl Condition="$(PackageJsonBugsUrl) == ''">https://github.com/cartier966/AngularAuthenticationLibrary/issues</PackageJsonBugsUrl>
|
|
11
|
-
<PackageJsonRepositoryType Condition="$(PackageJsonRepositoryType) == ''">git</PackageJsonRepositoryType>
|
|
12
|
-
<PackageJsonRepositoryUrl Condition="$(PackageJsonRepositoryUrl) == ''">git+https://github.com/cartier966/AngularAuthenticationLibrary.git</PackageJsonRepositoryUrl>
|
|
13
|
-
<PackageJsonLicense Condition="$(PackageJsonLicense) == ''">ISC</PackageJsonLicense>
|
|
14
|
-
<PackageJsonAuthor Condition="$(PackageJsonAuthor) == ''"></PackageJsonAuthor>
|
|
15
|
-
<PackageJsonType Condition="$(PackageJsonType) == ''">commonjs</PackageJsonType>
|
|
16
|
-
<PackageJsonMain Condition="$(PackageJsonMain) == ''">public-api.ts</PackageJsonMain>
|
|
17
|
-
<PackageJsonScriptsNg Condition="$(PackageJsonScriptsNg) == ''">ng</PackageJsonScriptsNg>
|
|
18
|
-
<PackageJsonScriptsStart Condition="$(PackageJsonScriptsStart) == ''">ng serve</PackageJsonScriptsStart>
|
|
19
|
-
<PackageJsonScriptsBuild Condition="$(PackageJsonScriptsBuild) == ''">ng build</PackageJsonScriptsBuild>
|
|
20
|
-
<PackageJsonScriptsWatch Condition="$(PackageJsonScriptsWatch) == ''">ng build --watch --configuration development</PackageJsonScriptsWatch>
|
|
21
|
-
<PackageJsonScriptsTest Condition="$(PackageJsonScriptsTest) == ''">ng test</PackageJsonScriptsTest>
|
|
22
|
-
<PackageJsonDependenciesAngularAnimations Condition="$(PackageJsonDependenciesAngularAnimations) == ''">^20.3.18</PackageJsonDependenciesAngularAnimations>
|
|
23
|
-
<PackageJsonDependenciesAngularCdk Condition="$(PackageJsonDependenciesAngularCdk) == ''">^20.2.14</PackageJsonDependenciesAngularCdk>
|
|
24
|
-
<PackageJsonDependenciesAngularCommon Condition="$(PackageJsonDependenciesAngularCommon) == ''">^20.3.18</PackageJsonDependenciesAngularCommon>
|
|
25
|
-
<PackageJsonDependenciesAngularCompiler Condition="$(PackageJsonDependenciesAngularCompiler) == ''">^20.3.18</PackageJsonDependenciesAngularCompiler>
|
|
26
|
-
<PackageJsonDependenciesAngularCore Condition="$(PackageJsonDependenciesAngularCore) == ''">^20.3.18</PackageJsonDependenciesAngularCore>
|
|
27
|
-
<PackageJsonDependenciesAngularForms Condition="$(PackageJsonDependenciesAngularForms) == ''">^20.3.18</PackageJsonDependenciesAngularForms>
|
|
28
|
-
<PackageJsonDependenciesAngularPlatformBrowser Condition="$(PackageJsonDependenciesAngularPlatformBrowser) == ''">^20.3.18</PackageJsonDependenciesAngularPlatformBrowser>
|
|
29
|
-
<PackageJsonDependenciesAngularPlatformBrowserDynamic Condition="$(PackageJsonDependenciesAngularPlatformBrowserDynamic) == ''">^20.3.18</PackageJsonDependenciesAngularPlatformBrowserDynamic>
|
|
30
|
-
<PackageJsonDependenciesAngularOauth2Oidc Condition="$(PackageJsonDependenciesAngularOauth2Oidc) == ''">^20.0.2</PackageJsonDependenciesAngularOauth2Oidc>
|
|
31
|
-
<PackageJsonDependenciesAngularOauth2OidcJwks Condition="$(PackageJsonDependenciesAngularOauth2OidcJwks) == ''">^20.0.0</PackageJsonDependenciesAngularOauth2OidcJwks>
|
|
32
|
-
<PackageJsonDependenciesAngularRouter Condition="$(PackageJsonDependenciesAngularRouter) == ''">^20.3.18</PackageJsonDependenciesAngularRouter>
|
|
33
|
-
<PackageJsonDependenciesPrimengThemes Condition="$(PackageJsonDependenciesPrimengThemes) == ''">^21.0.2</PackageJsonDependenciesPrimengThemes>
|
|
34
|
-
<PackageJsonDependenciesPrimeicons Condition="$(PackageJsonDependenciesPrimeicons) == ''">^7.0.0</PackageJsonDependenciesPrimeicons>
|
|
35
|
-
<PackageJsonDependenciesPrimeng Condition="$(PackageJsonDependenciesPrimeng) == ''">^20.4.0</PackageJsonDependenciesPrimeng>
|
|
36
|
-
<PackageJsonDependenciesRxjs Condition="$(PackageJsonDependenciesRxjs) == ''">~7.8.0</PackageJsonDependenciesRxjs>
|
|
37
|
-
<PackageJsonDependenciesTslib Condition="$(PackageJsonDependenciesTslib) == ''">^2.3.0</PackageJsonDependenciesTslib>
|
|
38
|
-
<PackageJsonDependenciesZoneJs Condition="$(PackageJsonDependenciesZoneJs) == ''">~0.15.0</PackageJsonDependenciesZoneJs>
|
|
39
|
-
<PackageJsonDevdependenciesAngularBuild Condition="$(PackageJsonDevdependenciesAngularBuild) == ''">^20.3.20</PackageJsonDevdependenciesAngularBuild>
|
|
40
|
-
<PackageJsonDevdependenciesAngularCli Condition="$(PackageJsonDevdependenciesAngularCli) == ''">^20.3.20</PackageJsonDevdependenciesAngularCli>
|
|
41
|
-
<PackageJsonDevdependenciesAngularCompilerCli Condition="$(PackageJsonDevdependenciesAngularCompilerCli) == ''">^20.3.18</PackageJsonDevdependenciesAngularCompilerCli>
|
|
42
|
-
<PackageJsonDevdependenciesTypesJasmine Condition="$(PackageJsonDevdependenciesTypesJasmine) == ''">~5.1.0</PackageJsonDevdependenciesTypesJasmine>
|
|
43
|
-
<PackageJsonDevdependenciesJasmineCore Condition="$(PackageJsonDevdependenciesJasmineCore) == ''">~5.6.0</PackageJsonDevdependenciesJasmineCore>
|
|
44
|
-
<PackageJsonDevdependenciesKarma Condition="$(PackageJsonDevdependenciesKarma) == ''">~6.4.0</PackageJsonDevdependenciesKarma>
|
|
45
|
-
<PackageJsonDevdependenciesKarmaChromeLauncher Condition="$(PackageJsonDevdependenciesKarmaChromeLauncher) == ''">~3.2.0</PackageJsonDevdependenciesKarmaChromeLauncher>
|
|
46
|
-
<PackageJsonDevdependenciesKarmaCoverage Condition="$(PackageJsonDevdependenciesKarmaCoverage) == ''">~2.2.0</PackageJsonDevdependenciesKarmaCoverage>
|
|
47
|
-
<PackageJsonDevdependenciesKarmaJasmine Condition="$(PackageJsonDevdependenciesKarmaJasmine) == ''">~5.1.0</PackageJsonDevdependenciesKarmaJasmine>
|
|
48
|
-
<PackageJsonDevdependenciesKarmaJasmineHtmlReporter Condition="$(PackageJsonDevdependenciesKarmaJasmineHtmlReporter) == ''">~2.1.0</PackageJsonDevdependenciesKarmaJasmineHtmlReporter>
|
|
49
|
-
<PackageJsonDevdependenciesNgPackagr Condition="$(PackageJsonDevdependenciesNgPackagr) == ''">^20.3.2</PackageJsonDevdependenciesNgPackagr>
|
|
50
|
-
<PackageJsonDevdependenciesTypescript Condition="$(PackageJsonDevdependenciesTypescript) == ''">~5.9.3</PackageJsonDevdependenciesTypescript>
|
|
51
|
-
</PropertyGroup>
|
|
52
|
-
</Project>
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# AuthenticationLib
|
|
2
|
-
|
|
3
|
-
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.0.
|
|
4
|
-
|
|
5
|
-
## Code scaffolding
|
|
6
|
-
|
|
7
|
-
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
ng generate component component-name
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
ng generate --help
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Building
|
|
20
|
-
|
|
21
|
-
To build the library, run:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
ng build authentication-lib
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
-
|
|
29
|
-
### Publishing the Library
|
|
30
|
-
|
|
31
|
-
Once the project is built, you can publish your library by following these steps:
|
|
32
|
-
|
|
33
|
-
1. Navigate to the `dist` directory:
|
|
34
|
-
```bash
|
|
35
|
-
cd dist/authentication-lib
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
39
|
-
```bash
|
|
40
|
-
npm publish
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Running unit tests
|
|
44
|
-
|
|
45
|
-
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
ng test
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Running end-to-end tests
|
|
52
|
-
|
|
53
|
-
For end-to-end (e2e) testing, run:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
ng e2e
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
60
|
-
|
|
61
|
-
## Additional Resources
|
|
62
|
-
|
|
63
|
-
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@bcweed/authentication-lib",
|
|
3
|
-
"version": "0.0.2",
|
|
4
|
-
"peerDependencies": {
|
|
5
|
-
"@angular/animations": "^20.3.18",
|
|
6
|
-
"@angular/cdk": "^20.2.14",
|
|
7
|
-
"@angular/common": "^20.3.18",
|
|
8
|
-
"@angular/compiler": "^20.3.18",
|
|
9
|
-
"@angular/core": "^20.3.18",
|
|
10
|
-
"@angular/forms": "^20.3.18",
|
|
11
|
-
"@angular/platform-browser": "^20.3.18",
|
|
12
|
-
"@angular/platform-browser-dynamic": "^20.3.18",
|
|
13
|
-
"angular-oauth2-oidc": "^20.0.2",
|
|
14
|
-
"angular-oauth2-oidc-jwks": "^20.0.0",
|
|
15
|
-
"@angular/router": "^20.3.18",
|
|
16
|
-
"@primeng/themes": "^21.0.2",
|
|
17
|
-
"primeicons": "^7.0.0",
|
|
18
|
-
"primeng": "^20.4.0",
|
|
19
|
-
"rxjs": "~7.8.0",
|
|
20
|
-
"tslib": "^2.3.0",
|
|
21
|
-
"zone.js": "~0.15.0"
|
|
22
|
-
},
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"tslib": "^2.3.0"
|
|
25
|
-
},
|
|
26
|
-
"sideEffects": false
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
File without changes
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { AuthCallbackComponent } from './auth-callback.component';
|
|
4
|
-
|
|
5
|
-
describe('AuthCallbackComponent', () => {
|
|
6
|
-
let component: AuthCallbackComponent;
|
|
7
|
-
let fixture: ComponentFixture<AuthCallbackComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [AuthCallbackComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(AuthCallbackComponent);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Component, OnInit } from '@angular/core';
|
|
2
|
-
import { OAuthEvent } from 'angular-oauth2-oidc';
|
|
3
|
-
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
|
|
4
|
-
import { AuthService } from '../auth.service';
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'app-auth-callback',
|
|
7
|
-
standalone: false,
|
|
8
|
-
templateUrl: './auth-callback.component.html',
|
|
9
|
-
styleUrl: './auth-callback.component.scss'
|
|
10
|
-
})
|
|
11
|
-
export class AuthCallbackComponent implements OnInit {
|
|
12
|
-
constructor(private router: Router, private activatedRoute: ActivatedRoute, private authService: AuthService) { }
|
|
13
|
-
|
|
14
|
-
ngOnInit(): void {
|
|
15
|
-
if (this.activatedRoute.snapshot.queryParams['error']) {
|
|
16
|
-
// this.authService.createAndSaveNonce();
|
|
17
|
-
this.authService.events$.subscribe((event: OAuthEvent) => {
|
|
18
|
-
if (event.type === 'code_error' && this.authService.state()) {
|
|
19
|
-
// Read and decode the original return URL from the state property
|
|
20
|
-
const redirectUrl = decodeURIComponent(this.authService.state()!);
|
|
21
|
-
|
|
22
|
-
// Redirect the user to the intended page
|
|
23
|
-
if (redirectUrl && redirectUrl !== '/') {
|
|
24
|
-
this.reRouteToError(redirectUrl);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const state = this.authService.state();
|
|
29
|
-
if (state && state !== undefined) {
|
|
30
|
-
const redirectUrl = decodeURIComponent(state);
|
|
31
|
-
if (redirectUrl && redirectUrl !== '/') {
|
|
32
|
-
this.reRouteToError(redirectUrl);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
this.reRouteToError('/');
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
this.authService.events$.subscribe((event: OAuthEvent) => {
|
|
42
|
-
if (event.type === 'token_received' && this.authService.state()) {
|
|
43
|
-
// Read and decode the original return URL from the state property
|
|
44
|
-
const redirectUrl = decodeURIComponent(this.authService.state()!);
|
|
45
|
-
|
|
46
|
-
// Redirect the user to the intended page
|
|
47
|
-
if (redirectUrl && redirectUrl !== '/') {
|
|
48
|
-
console.log('Redirecting to initially requested page:', redirectUrl);
|
|
49
|
-
this.router.navigateByUrl(redirectUrl);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
this.router.navigate(['/home']);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
private reRouteToError(redirectUrl:string): void {
|
|
60
|
-
const navigationExtras: NavigationExtras = {
|
|
61
|
-
queryParams: {
|
|
62
|
-
returnUrl: redirectUrl
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
this.router.navigate(['/authentication-error'], navigationExtras);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|