@thecla/auth0-angular 10.1.0 → 10.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/thecla-auth0-angular.mjs +37 -37
- package/fesm2022/thecla-auth0-angular.mjs.map +1 -1
- package/package.json +4 -4
- package/types/thecla-auth0-angular.d.ts +68 -0
- package/index.d.ts +0 -5
- package/lib/auth-config.d.ts +0 -10
- package/lib/auth.actions.d.ts +0 -28
- package/lib/auth.effects.d.ts +0 -32
- package/lib/auth.guard.d.ts +0 -11
- package/lib/auth.module.d.ts +0 -11
- package/lib/auth.reducer.d.ts +0 -24
- package/lib/auth.selectors.d.ts +0 -4
- package/lib/auth.service.d.ts +0 -22
- package/lib/jwt.interceptor.d.ts +0 -8
- package/lib/provide-auth.d.ts +0 -2
- package/public-api.d.ts +0 -7
|
@@ -6,9 +6,9 @@ import { filter, map, tap, first, switchMap, catchError, mergeMap } from 'rxjs/o
|
|
|
6
6
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
7
7
|
import { pipe, from, EMPTY, of } from 'rxjs';
|
|
8
8
|
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
9
|
-
import * as
|
|
10
|
-
import { createEffect, ofType, EffectsModule, provideEffects } from '@ngrx/effects';
|
|
11
|
-
import
|
|
9
|
+
import * as i2 from '@ngrx/effects';
|
|
10
|
+
import { Actions, createEffect, ofType, EffectsModule, provideEffects } from '@ngrx/effects';
|
|
11
|
+
import { Router } from '@angular/router';
|
|
12
12
|
import { Auth0Client } from '@auth0/auth0-spa-js';
|
|
13
13
|
|
|
14
14
|
const init = createAction('[@thecla/auth0-angular] init');
|
|
@@ -50,8 +50,8 @@ function getIsAuthenticatedSignal() {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
class AuthGuard {
|
|
53
|
-
constructor(
|
|
54
|
-
this.store =
|
|
53
|
+
constructor() {
|
|
54
|
+
this.store = inject(Store);
|
|
55
55
|
this.authenticated$ = this.store.pipe(isAuthenticated);
|
|
56
56
|
}
|
|
57
57
|
canActivate(next, state) {
|
|
@@ -61,32 +61,32 @@ class AuthGuard {
|
|
|
61
61
|
}
|
|
62
62
|
}), first());
|
|
63
63
|
}
|
|
64
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
65
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
64
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AuthGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
65
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AuthGuard, providedIn: 'root' }); }
|
|
66
66
|
}
|
|
67
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
67
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AuthGuard, decorators: [{
|
|
68
68
|
type: Injectable,
|
|
69
69
|
args: [{
|
|
70
70
|
providedIn: 'root',
|
|
71
71
|
}]
|
|
72
|
-
}]
|
|
72
|
+
}] });
|
|
73
73
|
|
|
74
74
|
class AuthConfig {
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
class AuthService {
|
|
78
|
-
constructor(
|
|
79
|
-
this.config =
|
|
78
|
+
constructor() {
|
|
79
|
+
this.config = inject(AuthConfig);
|
|
80
80
|
this.auth0 = new Auth0Client({
|
|
81
|
-
clientId: config.clientId,
|
|
81
|
+
clientId: this.config.clientId,
|
|
82
82
|
authorizationParams: {
|
|
83
|
-
audience: config.audience,
|
|
84
|
-
redirect_uri: config.redirectUri ?? location.origin,
|
|
85
|
-
scope: config.scope,
|
|
83
|
+
audience: this.config.audience,
|
|
84
|
+
redirect_uri: this.config.redirectUri ?? location.origin,
|
|
85
|
+
scope: this.config.scope,
|
|
86
86
|
},
|
|
87
|
-
domain: config.domain,
|
|
88
|
-
useRefreshTokens: config.useRefreshTokens,
|
|
89
|
-
sessionCheckExpiryDays: config.sessionCheckExpiryDays,
|
|
87
|
+
domain: this.config.domain,
|
|
88
|
+
useRefreshTokens: this.config.useRefreshTokens,
|
|
89
|
+
sessionCheckExpiryDays: this.config.sessionCheckExpiryDays,
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
isAuthenticated() {
|
|
@@ -113,21 +113,21 @@ class AuthService {
|
|
|
113
113
|
await this.auth0.checkSession();
|
|
114
114
|
return await this.auth0.isAuthenticated();
|
|
115
115
|
}
|
|
116
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
117
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
116
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
117
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AuthService, providedIn: 'root' }); }
|
|
118
118
|
}
|
|
119
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
119
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AuthService, decorators: [{
|
|
120
120
|
type: Injectable,
|
|
121
121
|
args: [{
|
|
122
122
|
providedIn: 'root',
|
|
123
123
|
}]
|
|
124
|
-
}], ctorParameters: () => [
|
|
124
|
+
}], ctorParameters: () => [] });
|
|
125
125
|
|
|
126
126
|
class AuthEffects {
|
|
127
|
-
constructor(
|
|
128
|
-
this.actions$ =
|
|
129
|
-
this.auth =
|
|
130
|
-
this.router =
|
|
127
|
+
constructor() {
|
|
128
|
+
this.actions$ = inject(Actions);
|
|
129
|
+
this.auth = inject(AuthService);
|
|
130
|
+
this.router = inject(Router);
|
|
131
131
|
this.signIn$ = createEffect(() => this.actions$.pipe(ofType(signIn), switchMap(action => this.auth.loginWithRedirect({ target: action.returnUrl }))), { dispatch: false });
|
|
132
132
|
this.signInCompleted$ = createEffect(() => this.actions$.pipe(ofType(signInCompleted), switchMap(() => this.auth.getUser().pipe(map(user => signedIn({ user })), catchError(error => of(signInFailed({ error })))))));
|
|
133
133
|
this.redirect$ = createEffect(() => this.actions$.pipe(ofType(signInCompleted), switchMap(action => this.router.navigateByUrl(action.state.target, { replaceUrl: true }))), { dispatch: false });
|
|
@@ -161,21 +161,21 @@ class AuthEffects {
|
|
|
161
161
|
completeSignIn() {
|
|
162
162
|
return this.auth.handleRedirectCallback().pipe(map(state => signInCompleted({ state })), catchError(error => of(signInFailed({ error }))));
|
|
163
163
|
}
|
|
164
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
165
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
164
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AuthEffects, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
165
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AuthEffects }); }
|
|
166
166
|
}
|
|
167
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
167
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AuthEffects, decorators: [{
|
|
168
168
|
type: Injectable
|
|
169
|
-
}]
|
|
169
|
+
}] });
|
|
170
170
|
|
|
171
171
|
class JwtInterceptor {
|
|
172
172
|
intercept(request, next) {
|
|
173
173
|
return jwtInterceptor(request, next.handle);
|
|
174
174
|
}
|
|
175
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
176
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
175
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: JwtInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
176
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: JwtInterceptor }); }
|
|
177
177
|
}
|
|
178
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
178
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: JwtInterceptor, decorators: [{
|
|
179
179
|
type: Injectable
|
|
180
180
|
}] });
|
|
181
181
|
const jwtInterceptor = (request, next) => {
|
|
@@ -210,11 +210,11 @@ class AuthModule {
|
|
|
210
210
|
],
|
|
211
211
|
};
|
|
212
212
|
}
|
|
213
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
214
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
215
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
213
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
214
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: AuthModule, imports: [i1.StoreFeatureModule, i2.EffectsFeatureModule] }); }
|
|
215
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AuthModule, imports: [StoreModule.forFeature(authFeature), EffectsModule.forFeature([AuthEffects])] }); }
|
|
216
216
|
}
|
|
217
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
217
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: AuthModule, decorators: [{
|
|
218
218
|
type: NgModule,
|
|
219
219
|
args: [{
|
|
220
220
|
declarations: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thecla-auth0-angular.mjs","sources":["../../../projects/auth0-angular/src/lib/auth.actions.ts","../../../projects/auth0-angular/src/lib/auth.reducer.ts","../../../projects/auth0-angular/src/lib/auth.selectors.ts","../../../projects/auth0-angular/src/lib/auth.guard.ts","../../../projects/auth0-angular/src/lib/auth-config.ts","../../../projects/auth0-angular/src/lib/auth.service.ts","../../../projects/auth0-angular/src/lib/auth.effects.ts","../../../projects/auth0-angular/src/lib/jwt.interceptor.ts","../../../projects/auth0-angular/src/lib/auth.module.ts","../../../projects/auth0-angular/src/lib/provide-auth.ts","../../../projects/auth0-angular/src/thecla-auth0-angular.ts"],"sourcesContent":["import { createAction, props } from '@ngrx/store';\nimport { Profile } from './auth.reducer';\n\nexport const init = createAction('[@thecla/auth0-angular] init');\n\nexport const signIn = createAction('[@thecla/auth0-angular] sign in', props<{ returnUrl: string }>());\n\nexport const signInCompleted = createAction(\n '[@thecla/auth0-angular] sign in completed',\n props<{ state: { target: string } }>(),\n);\n\nexport const signedIn = createAction('[@thecla/auth0-angular] signed in', props<{ user: Profile }>());\n\nexport const signInFailed = createAction('[@thecla/auth0-angular] sign in failed', props<{ error: Error }>());\n\nexport const signOut = createAction('[@thecla/auth0-angular] sign out');\n\nexport const signedOut = createAction('[@thecla/auth0-angular] signed out');\n","import { createFeature, createReducer, on } from '@ngrx/store';\nimport { signInFailed, signedIn, signedOut } from './auth.actions';\n\nexport interface Profile {\n [key: string]: any;\n sub?: string;\n name?: string;\n nickname?: string;\n picture?: string;\n email?: string;\n}\n\nexport interface State {\n authenticating: boolean;\n authenticated: boolean;\n user: Profile | undefined;\n}\n\nexport const noAuthentication: State = {\n authenticating: false,\n authenticated: false,\n user: undefined,\n};\n\nexport const startAuthentication: State = {\n authenticating: true,\n authenticated: false,\n user: undefined,\n};\n\nexport const authFeature = createFeature({\n name: 'auth',\n reducer: createReducer(\n startAuthentication,\n on(signedIn, (state, { user }) => ({\n ...state,\n authenticating: false,\n authenticated: true,\n user,\n })),\n on(signedOut, _ => noAuthentication),\n on(signInFailed, _ => noAuthentication),\n ),\n});\n\nexport const { selectAuthState, reducer } = authFeature;\n","import { inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { Store, select } from '@ngrx/store';\nimport { pipe } from 'rxjs';\nimport { filter, map } from 'rxjs/operators';\nimport { selectAuthState } from './auth.reducer';\n\nexport const isAuthenticated = pipe(\n select(selectAuthState),\n filter(state => !state.authenticating),\n map(state => state.authenticated),\n);\n\nexport const getUser = pipe(\n select(selectAuthState),\n filter(state => !state.authenticating),\n map(state => state.user),\n);\n\nexport function getUserSignal() {\n return toSignal(inject(Store).pipe(getUser));\n}\n\nexport function getIsAuthenticatedSignal() {\n return toSignal(inject(Store).pipe(isAuthenticated));\n}\n","import { Injectable } from '@angular/core';\nimport { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router';\nimport { Store } from '@ngrx/store';\nimport { first, tap } from 'rxjs/operators';\nimport { signIn } from './auth.actions';\nimport { isAuthenticated } from './auth.selectors';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthGuard implements CanActivate {\n private readonly authenticated$ = this.store.pipe(isAuthenticated);\n\n public constructor(private readonly store: Store) {}\n\n public canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot) {\n return this.authenticated$.pipe(\n tap(auth => {\n if (!auth) {\n this.store.dispatch(signIn({ returnUrl: state.url }));\n }\n }),\n first(),\n );\n }\n}\n","export abstract class AuthConfig {\n public abstract audience: string;\n public abstract clientId: string;\n public abstract domain: string;\n public abstract scope: string;\n public abstract redirectUri?: string;\n public abstract logoutUri?: string;\n public abstract useRefreshTokens?: boolean;\n public abstract sessionCheckExpiryDays?: number;\n}\n","import { Injectable } from '@angular/core';\nimport { Auth0Client, User } from '@auth0/auth0-spa-js';\nimport { EMPTY, from, Observable } from 'rxjs';\nimport { filter, map, switchMap } from 'rxjs/operators';\nimport { AuthConfig } from './auth-config';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthService {\n private readonly auth0: Auth0Client;\n\n public constructor(private readonly config: AuthConfig) {\n this.auth0 = new Auth0Client({\n clientId: config.clientId,\n authorizationParams: {\n audience: config.audience,\n redirect_uri: config.redirectUri ?? location.origin,\n scope: config.scope,\n },\n domain: config.domain,\n useRefreshTokens: config.useRefreshTokens,\n sessionCheckExpiryDays: config.sessionCheckExpiryDays,\n });\n }\n\n public isAuthenticated() {\n return from(this.checkSession());\n }\n\n public loginWithRedirect(appState: { target: string }) {\n return from(this.auth0.loginWithRedirect({ appState })).pipe(switchMap(() => EMPTY));\n }\n\n public handleRedirectCallback() {\n return from(this.auth0.handleRedirectCallback()).pipe(map(result => result.appState as { target: string }));\n }\n\n public getUser() {\n return from(this.auth0.getUser()).pipe(filter((u): u is User => u !== undefined));\n }\n\n public getAccessToken(): Observable<unknown> {\n return from(this.auth0.getTokenSilently());\n }\n\n public logout() {\n this.auth0.logout({\n logoutParams: { returnTo: this.config.logoutUri ?? location.origin },\n });\n }\n\n private async checkSession() {\n await this.auth0.checkSession();\n\n return await this.auth0.isAuthenticated();\n }\n}\n","import { Injectable } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { Actions, createEffect, ofType, OnInitEffects } from '@ngrx/effects';\nimport { of } from 'rxjs';\nimport { catchError, map, switchMap, tap } from 'rxjs/operators';\nimport { init, signedIn, signedOut, signIn, signInCompleted, signInFailed, signOut } from './auth.actions';\nimport { AuthService } from './auth.service';\n\n@Injectable()\nexport class AuthEffects implements OnInitEffects {\n public readonly signIn$ = createEffect(\n () =>\n this.actions$.pipe(\n ofType(signIn),\n switchMap(action => this.auth.loginWithRedirect({ target: action.returnUrl })),\n ),\n { dispatch: false },\n );\n\n public readonly signInCompleted$ = createEffect(() =>\n this.actions$.pipe(\n ofType(signInCompleted),\n switchMap(() =>\n this.auth.getUser().pipe(\n map(user => signedIn({ user })),\n catchError(error => of(signInFailed({ error }))),\n ),\n ),\n ),\n );\n\n public readonly redirect$ = createEffect(\n () =>\n this.actions$.pipe(\n ofType(signInCompleted),\n switchMap(action => this.router.navigateByUrl(action.state.target, { replaceUrl: true })),\n ),\n { dispatch: false },\n );\n\n public readonly signOut$ = createEffect(() =>\n this.actions$.pipe(\n ofType(signOut),\n tap(() => {\n try {\n this.auth.logout();\n } catch {}\n }),\n map(() => signedOut()),\n ),\n );\n\n public readonly init$ = createEffect(() =>\n this.actions$.pipe(\n ofType(init),\n switchMap(() => {\n const params = window.location.search;\n\n if (params.includes('code=') && params.includes('state=')) {\n return this.completeSignIn();\n } else {\n return this.auth.isAuthenticated().pipe(\n switchMap(auth => this.getAuthResult(auth)),\n catchError(error => of(signInFailed({ error }))),\n );\n }\n }),\n ),\n );\n\n public constructor(\n private readonly actions$: Actions,\n private readonly auth: AuthService,\n private readonly router: Router,\n ) {}\n\n public ngrxOnInitEffects() {\n return init();\n }\n\n private getAuthResult(auth: boolean) {\n if (auth) {\n return this.auth.getUser().pipe(map(user => signedIn({ user })));\n } else {\n return of(signedOut());\n }\n }\n\n private completeSignIn() {\n return this.auth.handleRedirectCallback().pipe(\n map(state => signInCompleted({ state })),\n catchError(error => of(signInFailed({ error }))),\n );\n }\n}\n","import { HttpHandler, HttpInterceptor, HttpInterceptorFn, HttpRequest } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { map, mergeMap } from 'rxjs/operators';\nimport { AuthService } from './auth.service';\n\n@Injectable()\nexport class JwtInterceptor implements HttpInterceptor {\n public intercept(request: HttpRequest<any>, next: HttpHandler) {\n return jwtInterceptor(request, next.handle);\n }\n}\n\nexport const jwtInterceptor: HttpInterceptorFn = (request, next) => {\n if (isSameDomain(request)) {\n return inject(AuthService)\n .getAccessToken()\n .pipe(\n map(token => request.clone({ setHeaders: { Authorization: `Bearer ${token}` } })),\n mergeMap(authorizedRequest => next(authorizedRequest)),\n );\n } else {\n return next(request);\n }\n};\n\nfunction isSameDomain(request: HttpRequest<any>) {\n const isAbsolute = /^https?:\\/\\//i.test(request.url);\n\n return !isAbsolute;\n}\n","import { HTTP_INTERCEPTORS } from '@angular/common/http';\nimport { ModuleWithProviders, NgModule } from '@angular/core';\nimport { EffectsModule } from '@ngrx/effects';\nimport { StoreModule } from '@ngrx/store';\nimport { AuthConfig } from './auth-config';\nimport { AuthEffects } from './auth.effects';\nimport { authFeature } from './auth.reducer';\nimport { JwtInterceptor } from './jwt.interceptor';\n\n@NgModule({\n declarations: [],\n imports: [StoreModule.forFeature(authFeature), EffectsModule.forFeature([AuthEffects])],\n exports: [],\n})\nexport class AuthModule {\n public static forRoot(config: AuthConfig): ModuleWithProviders<AuthModule> {\n return {\n ngModule: AuthModule,\n providers: [\n {\n provide: AuthConfig,\n useValue: config,\n },\n {\n provide: HTTP_INTERCEPTORS,\n useClass: JwtInterceptor,\n multi: true,\n },\n ],\n };\n }\n}\n","import { makeEnvironmentProviders } from '@angular/core';\nimport { provideEffects } from '@ngrx/effects';\nimport { provideState } from '@ngrx/store';\nimport { AuthConfig } from './auth-config';\nimport { AuthEffects } from './auth.effects';\nimport { authFeature } from './auth.reducer';\n\nexport function provideAuth(config: AuthConfig) {\n const effects = provideEffects(AuthEffects);\n const state = provideState(authFeature);\n\n return makeEnvironmentProviders([\n effects,\n state,\n {\n provide: AuthConfig,\n useValue: config,\n },\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.AuthConfig","i1","i2.AuthService","i2"],"mappings":";;;;;;;;;;;;;AAGO,MAAM,IAAI,GAAG,YAAY,CAAC,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A;AACE,YAAA,OAAO,EAAE,UAAU;AACnB,YAAA,QAAQ,EAAE,MAAM;AACjB,SAAA;AACF,KAAA,CAAC;AACJ;;ACnBA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"thecla-auth0-angular.mjs","sources":["../../../projects/auth0-angular/src/lib/auth.actions.ts","../../../projects/auth0-angular/src/lib/auth.reducer.ts","../../../projects/auth0-angular/src/lib/auth.selectors.ts","../../../projects/auth0-angular/src/lib/auth.guard.ts","../../../projects/auth0-angular/src/lib/auth-config.ts","../../../projects/auth0-angular/src/lib/auth.service.ts","../../../projects/auth0-angular/src/lib/auth.effects.ts","../../../projects/auth0-angular/src/lib/jwt.interceptor.ts","../../../projects/auth0-angular/src/lib/auth.module.ts","../../../projects/auth0-angular/src/lib/provide-auth.ts","../../../projects/auth0-angular/src/thecla-auth0-angular.ts"],"sourcesContent":["import { createAction, props } from '@ngrx/store';\nimport { Profile } from './auth.reducer';\n\nexport const init = createAction('[@thecla/auth0-angular] init');\n\nexport const signIn = createAction('[@thecla/auth0-angular] sign in', props<{ returnUrl: string }>());\n\nexport const signInCompleted = createAction(\n '[@thecla/auth0-angular] sign in completed',\n props<{ state: { target: string } }>(),\n);\n\nexport const signedIn = createAction('[@thecla/auth0-angular] signed in', props<{ user: Profile }>());\n\nexport const signInFailed = createAction('[@thecla/auth0-angular] sign in failed', props<{ error: Error }>());\n\nexport const signOut = createAction('[@thecla/auth0-angular] sign out');\n\nexport const signedOut = createAction('[@thecla/auth0-angular] signed out');\n","import { createFeature, createReducer, on } from '@ngrx/store';\nimport { signInFailed, signedIn, signedOut } from './auth.actions';\n\nexport interface Profile {\n [key: string]: any;\n sub?: string;\n name?: string;\n nickname?: string;\n picture?: string;\n email?: string;\n}\n\nexport interface State {\n authenticating: boolean;\n authenticated: boolean;\n user: Profile | undefined;\n}\n\nexport const noAuthentication: State = {\n authenticating: false,\n authenticated: false,\n user: undefined,\n};\n\nexport const startAuthentication: State = {\n authenticating: true,\n authenticated: false,\n user: undefined,\n};\n\nexport const authFeature = createFeature({\n name: 'auth',\n reducer: createReducer(\n startAuthentication,\n on(signedIn, (state, { user }) => ({\n ...state,\n authenticating: false,\n authenticated: true,\n user,\n })),\n on(signedOut, _ => noAuthentication),\n on(signInFailed, _ => noAuthentication),\n ),\n});\n\nexport const { selectAuthState, reducer } = authFeature;\n","import { inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { Store, select } from '@ngrx/store';\nimport { pipe } from 'rxjs';\nimport { filter, map } from 'rxjs/operators';\nimport { selectAuthState } from './auth.reducer';\n\nexport const isAuthenticated = pipe(\n select(selectAuthState),\n filter(state => !state.authenticating),\n map(state => state.authenticated),\n);\n\nexport const getUser = pipe(\n select(selectAuthState),\n filter(state => !state.authenticating),\n map(state => state.user),\n);\n\nexport function getUserSignal() {\n return toSignal(inject(Store).pipe(getUser));\n}\n\nexport function getIsAuthenticatedSignal() {\n return toSignal(inject(Store).pipe(isAuthenticated));\n}\n","import { Injectable, inject } from '@angular/core';\nimport { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router';\nimport { Store } from '@ngrx/store';\nimport { first, tap } from 'rxjs/operators';\nimport { signIn } from './auth.actions';\nimport { isAuthenticated } from './auth.selectors';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthGuard implements CanActivate {\n private readonly store = inject(Store);\n\n private readonly authenticated$ = this.store.pipe(isAuthenticated);\n\n public canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot) {\n return this.authenticated$.pipe(\n tap(auth => {\n if (!auth) {\n this.store.dispatch(signIn({ returnUrl: state.url }));\n }\n }),\n first(),\n );\n }\n}\n","export abstract class AuthConfig {\n public abstract audience: string;\n public abstract clientId: string;\n public abstract domain: string;\n public abstract scope: string;\n public abstract redirectUri?: string;\n public abstract logoutUri?: string;\n public abstract useRefreshTokens?: boolean;\n public abstract sessionCheckExpiryDays?: number;\n}\n","import { inject, Injectable } from '@angular/core';\nimport { Auth0Client, User } from '@auth0/auth0-spa-js';\nimport { EMPTY, from, Observable } from 'rxjs';\nimport { filter, map, switchMap } from 'rxjs/operators';\nimport { AuthConfig } from './auth-config';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AuthService {\n private readonly config = inject(AuthConfig);\n\n private readonly auth0: Auth0Client;\n\n public constructor() {\n this.auth0 = new Auth0Client({\n clientId: this.config.clientId,\n authorizationParams: {\n audience: this.config.audience,\n redirect_uri: this.config.redirectUri ?? location.origin,\n scope: this.config.scope,\n },\n domain: this.config.domain,\n useRefreshTokens: this.config.useRefreshTokens,\n sessionCheckExpiryDays: this.config.sessionCheckExpiryDays,\n });\n }\n\n public isAuthenticated() {\n return from(this.checkSession());\n }\n\n public loginWithRedirect(appState: { target: string }) {\n return from(this.auth0.loginWithRedirect({ appState })).pipe(switchMap(() => EMPTY));\n }\n\n public handleRedirectCallback() {\n return from(this.auth0.handleRedirectCallback()).pipe(map(result => result.appState as { target: string }));\n }\n\n public getUser() {\n return from(this.auth0.getUser()).pipe(filter((u): u is User => u !== undefined));\n }\n\n public getAccessToken(): Observable<unknown> {\n return from(this.auth0.getTokenSilently());\n }\n\n public logout() {\n this.auth0.logout({\n logoutParams: { returnTo: this.config.logoutUri ?? location.origin },\n });\n }\n\n private async checkSession() {\n await this.auth0.checkSession();\n\n return await this.auth0.isAuthenticated();\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { Actions, createEffect, ofType, OnInitEffects } from '@ngrx/effects';\nimport { of } from 'rxjs';\nimport { catchError, map, switchMap, tap } from 'rxjs/operators';\nimport { init, signedIn, signedOut, signIn, signInCompleted, signInFailed, signOut } from './auth.actions';\nimport { AuthService } from './auth.service';\n\n@Injectable()\nexport class AuthEffects implements OnInitEffects {\n private readonly actions$ = inject(Actions);\n private readonly auth = inject(AuthService);\n private readonly router = inject(Router);\n\n public readonly signIn$ = createEffect(\n () =>\n this.actions$.pipe(\n ofType(signIn),\n switchMap(action => this.auth.loginWithRedirect({ target: action.returnUrl })),\n ),\n { dispatch: false },\n );\n\n public readonly signInCompleted$ = createEffect(() =>\n this.actions$.pipe(\n ofType(signInCompleted),\n switchMap(() =>\n this.auth.getUser().pipe(\n map(user => signedIn({ user })),\n catchError(error => of(signInFailed({ error }))),\n ),\n ),\n ),\n );\n\n public readonly redirect$ = createEffect(\n () =>\n this.actions$.pipe(\n ofType(signInCompleted),\n switchMap(action => this.router.navigateByUrl(action.state.target, { replaceUrl: true })),\n ),\n { dispatch: false },\n );\n\n public readonly signOut$ = createEffect(() =>\n this.actions$.pipe(\n ofType(signOut),\n tap(() => {\n try {\n this.auth.logout();\n } catch {}\n }),\n map(() => signedOut()),\n ),\n );\n\n public readonly init$ = createEffect(() =>\n this.actions$.pipe(\n ofType(init),\n switchMap(() => {\n const params = window.location.search;\n\n if (params.includes('code=') && params.includes('state=')) {\n return this.completeSignIn();\n } else {\n return this.auth.isAuthenticated().pipe(\n switchMap(auth => this.getAuthResult(auth)),\n catchError(error => of(signInFailed({ error }))),\n );\n }\n }),\n ),\n );\n\n public ngrxOnInitEffects() {\n return init();\n }\n\n private getAuthResult(auth: boolean) {\n if (auth) {\n return this.auth.getUser().pipe(map(user => signedIn({ user })));\n } else {\n return of(signedOut());\n }\n }\n\n private completeSignIn() {\n return this.auth.handleRedirectCallback().pipe(\n map(state => signInCompleted({ state })),\n catchError(error => of(signInFailed({ error }))),\n );\n }\n}\n","import { HttpHandler, HttpInterceptor, HttpInterceptorFn, HttpRequest } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { map, mergeMap } from 'rxjs/operators';\nimport { AuthService } from './auth.service';\n\n@Injectable()\nexport class JwtInterceptor implements HttpInterceptor {\n public intercept(request: HttpRequest<any>, next: HttpHandler) {\n return jwtInterceptor(request, next.handle);\n }\n}\n\nexport const jwtInterceptor: HttpInterceptorFn = (request, next) => {\n if (isSameDomain(request)) {\n return inject(AuthService)\n .getAccessToken()\n .pipe(\n map(token => request.clone({ setHeaders: { Authorization: `Bearer ${token}` } })),\n mergeMap(authorizedRequest => next(authorizedRequest)),\n );\n } else {\n return next(request);\n }\n};\n\nfunction isSameDomain(request: HttpRequest<any>) {\n const isAbsolute = /^https?:\\/\\//i.test(request.url);\n\n return !isAbsolute;\n}\n","import { HTTP_INTERCEPTORS } from '@angular/common/http';\nimport { ModuleWithProviders, NgModule } from '@angular/core';\nimport { EffectsModule } from '@ngrx/effects';\nimport { StoreModule } from '@ngrx/store';\nimport { AuthConfig } from './auth-config';\nimport { AuthEffects } from './auth.effects';\nimport { authFeature } from './auth.reducer';\nimport { JwtInterceptor } from './jwt.interceptor';\n\n@NgModule({\n declarations: [],\n imports: [StoreModule.forFeature(authFeature), EffectsModule.forFeature([AuthEffects])],\n exports: [],\n})\nexport class AuthModule {\n public static forRoot(config: AuthConfig): ModuleWithProviders<AuthModule> {\n return {\n ngModule: AuthModule,\n providers: [\n {\n provide: AuthConfig,\n useValue: config,\n },\n {\n provide: HTTP_INTERCEPTORS,\n useClass: JwtInterceptor,\n multi: true,\n },\n ],\n };\n }\n}\n","import { makeEnvironmentProviders } from '@angular/core';\nimport { provideEffects } from '@ngrx/effects';\nimport { provideState } from '@ngrx/store';\nimport { AuthConfig } from './auth-config';\nimport { AuthEffects } from './auth.effects';\nimport { authFeature } from './auth.reducer';\n\nexport function provideAuth(config: AuthConfig) {\n const effects = provideEffects(AuthEffects);\n const state = provideState(authFeature);\n\n return makeEnvironmentProviders([\n effects,\n state,\n {\n provide: AuthConfig,\n useValue: config,\n },\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAGO,MAAM,IAAI,GAAG,YAAY,CAAC,8BAA8B,CAAC;AAEzD,MAAM,MAAM,GAAG,YAAY,CAAC,iCAAiC,EAAE,KAAK,EAAyB;AAE7F,MAAM,eAAe,GAAG,YAAY,CACzC,2CAA2C,EAC3C,KAAK,EAAiC,CACvC;AAEM,MAAM,Q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AACF,KAAA,CAAC;AACJ;;ACnBA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thecla/auth0-angular",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.3.0",
|
|
4
4
|
"author": "Hendrik Wouters",
|
|
5
5
|
"description": "Angular module using NGRX to authenticate with Auth0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/
|
|
8
|
+
"url": "git+https://github.com/HWouters/auth0-angular.git"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|
|
11
11
|
"ngrx",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"tslib": "^2.0.0"
|
|
31
31
|
},
|
|
32
32
|
"module": "fesm2022/thecla-auth0-angular.mjs",
|
|
33
|
-
"typings": "
|
|
33
|
+
"typings": "types/thecla-auth0-angular.d.ts",
|
|
34
34
|
"exports": {
|
|
35
35
|
"./package.json": {
|
|
36
36
|
"default": "./package.json"
|
|
37
37
|
},
|
|
38
38
|
".": {
|
|
39
|
-
"types": "./
|
|
39
|
+
"types": "./types/thecla-auth0-angular.d.ts",
|
|
40
40
|
"default": "./fesm2022/thecla-auth0-angular.mjs"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as _ngrx_store from '@ngrx/store';
|
|
2
|
+
import * as rxjs from 'rxjs';
|
|
3
|
+
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { ModuleWithProviders } from '@angular/core';
|
|
6
|
+
import * as i2 from '@ngrx/effects';
|
|
7
|
+
import * as _thecla_auth0_angular from '@thecla/auth0-angular';
|
|
8
|
+
import { HttpInterceptorFn } from '@angular/common/http';
|
|
9
|
+
|
|
10
|
+
interface Profile {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
sub?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
nickname?: string;
|
|
15
|
+
picture?: string;
|
|
16
|
+
email?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare const signIn: _ngrx_store.ActionCreator<"[@thecla/auth0-angular] sign in", (props: {
|
|
20
|
+
returnUrl: string;
|
|
21
|
+
}) => {
|
|
22
|
+
returnUrl: string;
|
|
23
|
+
} & _ngrx_store.Action<"[@thecla/auth0-angular] sign in">>;
|
|
24
|
+
declare const signedIn: _ngrx_store.ActionCreator<"[@thecla/auth0-angular] signed in", (props: {
|
|
25
|
+
user: Profile;
|
|
26
|
+
}) => {
|
|
27
|
+
user: Profile;
|
|
28
|
+
} & _ngrx_store.Action<"[@thecla/auth0-angular] signed in">>;
|
|
29
|
+
declare const signOut: _ngrx_store.ActionCreator<"[@thecla/auth0-angular] sign out", () => _ngrx_store.Action<"[@thecla/auth0-angular] sign out">>;
|
|
30
|
+
declare const signedOut: _ngrx_store.ActionCreator<"[@thecla/auth0-angular] signed out", () => _ngrx_store.Action<"[@thecla/auth0-angular] signed out">>;
|
|
31
|
+
|
|
32
|
+
declare class AuthGuard implements CanActivate {
|
|
33
|
+
private readonly store;
|
|
34
|
+
private readonly authenticated$;
|
|
35
|
+
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): rxjs.Observable<boolean>;
|
|
36
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AuthGuard, never>;
|
|
37
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AuthGuard>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare abstract class AuthConfig {
|
|
41
|
+
abstract audience: string;
|
|
42
|
+
abstract clientId: string;
|
|
43
|
+
abstract domain: string;
|
|
44
|
+
abstract scope: string;
|
|
45
|
+
abstract redirectUri?: string;
|
|
46
|
+
abstract logoutUri?: string;
|
|
47
|
+
abstract useRefreshTokens?: boolean;
|
|
48
|
+
abstract sessionCheckExpiryDays?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
declare class AuthModule {
|
|
52
|
+
static forRoot(config: AuthConfig): ModuleWithProviders<AuthModule>;
|
|
53
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AuthModule, never>;
|
|
54
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<AuthModule, never, [typeof _ngrx_store.StoreFeatureModule, typeof i2.EffectsFeatureModule], never>;
|
|
55
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<AuthModule>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
declare const isAuthenticated: rxjs.UnaryFunction<rxjs.Observable<Record<string, any>>, rxjs.Observable<boolean>>;
|
|
59
|
+
declare const getUser: rxjs.UnaryFunction<rxjs.Observable<Record<string, any>>, rxjs.Observable<_thecla_auth0_angular.Profile | undefined>>;
|
|
60
|
+
declare function getUserSignal(): i0.Signal<_thecla_auth0_angular.Profile | undefined>;
|
|
61
|
+
declare function getIsAuthenticatedSignal(): i0.Signal<boolean | undefined>;
|
|
62
|
+
|
|
63
|
+
declare const jwtInterceptor: HttpInterceptorFn;
|
|
64
|
+
|
|
65
|
+
declare function provideAuth(config: AuthConfig): i0.EnvironmentProviders;
|
|
66
|
+
|
|
67
|
+
export { AuthGuard, AuthModule, getIsAuthenticatedSignal, getUser, getUserSignal, isAuthenticated, jwtInterceptor, provideAuth, signIn, signOut, signedIn, signedOut };
|
|
68
|
+
export type { Profile };
|
package/index.d.ts
DELETED
package/lib/auth-config.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare abstract class AuthConfig {
|
|
2
|
-
abstract audience: string;
|
|
3
|
-
abstract clientId: string;
|
|
4
|
-
abstract domain: string;
|
|
5
|
-
abstract scope: string;
|
|
6
|
-
abstract redirectUri?: string;
|
|
7
|
-
abstract logoutUri?: string;
|
|
8
|
-
abstract useRefreshTokens?: boolean;
|
|
9
|
-
abstract sessionCheckExpiryDays?: number;
|
|
10
|
-
}
|
package/lib/auth.actions.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Profile } from './auth.reducer';
|
|
2
|
-
export declare const init: import("@ngrx/store").ActionCreator<"[@thecla/auth0-angular] init", () => import("@ngrx/store").Action<"[@thecla/auth0-angular] init">>;
|
|
3
|
-
export declare const signIn: import("@ngrx/store").ActionCreator<"[@thecla/auth0-angular] sign in", (props: {
|
|
4
|
-
returnUrl: string;
|
|
5
|
-
}) => {
|
|
6
|
-
returnUrl: string;
|
|
7
|
-
} & import("@ngrx/store").Action<"[@thecla/auth0-angular] sign in">>;
|
|
8
|
-
export declare const signInCompleted: import("@ngrx/store").ActionCreator<"[@thecla/auth0-angular] sign in completed", (props: {
|
|
9
|
-
state: {
|
|
10
|
-
target: string;
|
|
11
|
-
};
|
|
12
|
-
}) => {
|
|
13
|
-
state: {
|
|
14
|
-
target: string;
|
|
15
|
-
};
|
|
16
|
-
} & import("@ngrx/store").Action<"[@thecla/auth0-angular] sign in completed">>;
|
|
17
|
-
export declare const signedIn: import("@ngrx/store").ActionCreator<"[@thecla/auth0-angular] signed in", (props: {
|
|
18
|
-
user: Profile;
|
|
19
|
-
}) => {
|
|
20
|
-
user: Profile;
|
|
21
|
-
} & import("@ngrx/store").Action<"[@thecla/auth0-angular] signed in">>;
|
|
22
|
-
export declare const signInFailed: import("@ngrx/store").ActionCreator<"[@thecla/auth0-angular] sign in failed", (props: {
|
|
23
|
-
error: Error;
|
|
24
|
-
}) => {
|
|
25
|
-
error: Error;
|
|
26
|
-
} & import("@ngrx/store").Action<"[@thecla/auth0-angular] sign in failed">>;
|
|
27
|
-
export declare const signOut: import("@ngrx/store").ActionCreator<"[@thecla/auth0-angular] sign out", () => import("@ngrx/store").Action<"[@thecla/auth0-angular] sign out">>;
|
|
28
|
-
export declare const signedOut: import("@ngrx/store").ActionCreator<"[@thecla/auth0-angular] signed out", () => import("@ngrx/store").Action<"[@thecla/auth0-angular] signed out">>;
|
package/lib/auth.effects.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Router } from '@angular/router';
|
|
2
|
-
import { Actions, OnInitEffects } from '@ngrx/effects';
|
|
3
|
-
import { AuthService } from './auth.service';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
export declare class AuthEffects implements OnInitEffects {
|
|
6
|
-
private readonly actions$;
|
|
7
|
-
private readonly auth;
|
|
8
|
-
private readonly router;
|
|
9
|
-
readonly signIn$: import("rxjs").Observable<never> & import("@ngrx/effects").CreateEffectMetadata;
|
|
10
|
-
readonly signInCompleted$: import("rxjs").Observable<({
|
|
11
|
-
user: import("@thecla/auth0-angular").Profile;
|
|
12
|
-
} & import("@ngrx/store").Action<"[@thecla/auth0-angular] signed in">) | ({
|
|
13
|
-
error: Error;
|
|
14
|
-
} & import("@ngrx/store").Action<"[@thecla/auth0-angular] sign in failed">)> & import("@ngrx/effects").CreateEffectMetadata;
|
|
15
|
-
readonly redirect$: import("rxjs").Observable<boolean> & import("@ngrx/effects").CreateEffectMetadata;
|
|
16
|
-
readonly signOut$: import("rxjs").Observable<import("@ngrx/store").Action<"[@thecla/auth0-angular] signed out">> & import("@ngrx/effects").CreateEffectMetadata;
|
|
17
|
-
readonly init$: import("rxjs").Observable<({
|
|
18
|
-
user: import("@thecla/auth0-angular").Profile;
|
|
19
|
-
} & import("@ngrx/store").Action<"[@thecla/auth0-angular] signed in">) | import("@ngrx/store").Action<"[@thecla/auth0-angular] signed out"> | ({
|
|
20
|
-
error: Error;
|
|
21
|
-
} & import("@ngrx/store").Action<"[@thecla/auth0-angular] sign in failed">) | ({
|
|
22
|
-
state: {
|
|
23
|
-
target: string;
|
|
24
|
-
};
|
|
25
|
-
} & import("@ngrx/store").Action<"[@thecla/auth0-angular] sign in completed">)> & import("@ngrx/effects").CreateEffectMetadata;
|
|
26
|
-
constructor(actions$: Actions, auth: AuthService, router: Router);
|
|
27
|
-
ngrxOnInitEffects(): import("@ngrx/store").Action<"[@thecla/auth0-angular] init">;
|
|
28
|
-
private getAuthResult;
|
|
29
|
-
private completeSignIn;
|
|
30
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AuthEffects, never>;
|
|
31
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<AuthEffects>;
|
|
32
|
-
}
|
package/lib/auth.guard.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot } from '@angular/router';
|
|
2
|
-
import { Store } from '@ngrx/store';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class AuthGuard implements CanActivate {
|
|
5
|
-
private readonly store;
|
|
6
|
-
private readonly authenticated$;
|
|
7
|
-
constructor(store: Store);
|
|
8
|
-
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): import("rxjs").Observable<boolean>;
|
|
9
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AuthGuard, never>;
|
|
10
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<AuthGuard>;
|
|
11
|
-
}
|
package/lib/auth.module.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ModuleWithProviders } from '@angular/core';
|
|
2
|
-
import { AuthConfig } from './auth-config';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "@ngrx/store";
|
|
5
|
-
import * as i2 from "@ngrx/effects";
|
|
6
|
-
export declare class AuthModule {
|
|
7
|
-
static forRoot(config: AuthConfig): ModuleWithProviders<AuthModule>;
|
|
8
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AuthModule, never>;
|
|
9
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<AuthModule, never, [typeof i1.StoreFeatureModule, typeof i2.EffectsFeatureModule], never>;
|
|
10
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<AuthModule>;
|
|
11
|
-
}
|
package/lib/auth.reducer.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export interface Profile {
|
|
2
|
-
[key: string]: any;
|
|
3
|
-
sub?: string;
|
|
4
|
-
name?: string;
|
|
5
|
-
nickname?: string;
|
|
6
|
-
picture?: string;
|
|
7
|
-
email?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface State {
|
|
10
|
-
authenticating: boolean;
|
|
11
|
-
authenticated: boolean;
|
|
12
|
-
user: Profile | undefined;
|
|
13
|
-
}
|
|
14
|
-
export declare const noAuthentication: State;
|
|
15
|
-
export declare const startAuthentication: State;
|
|
16
|
-
export declare const authFeature: {
|
|
17
|
-
name: "auth";
|
|
18
|
-
reducer: import("@ngrx/store").ActionReducer<State, import("@ngrx/store").Action<string>>;
|
|
19
|
-
selectAuthState: import("@ngrx/store").MemoizedSelector<Record<string, any>, State, (featureState: State) => State>;
|
|
20
|
-
selectUser: import("@ngrx/store").MemoizedSelector<Record<string, any>, Profile | undefined, (featureState: State) => Profile | undefined>;
|
|
21
|
-
selectAuthenticating: import("@ngrx/store").MemoizedSelector<Record<string, any>, boolean, (featureState: State) => boolean>;
|
|
22
|
-
selectAuthenticated: import("@ngrx/store").MemoizedSelector<Record<string, any>, boolean, (featureState: State) => boolean>;
|
|
23
|
-
};
|
|
24
|
-
export declare const selectAuthState: import("@ngrx/store").MemoizedSelector<Record<string, any>, State, (featureState: State) => State>, reducer: import("@ngrx/store").ActionReducer<State, import("@ngrx/store").Action<string>>;
|
package/lib/auth.selectors.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const isAuthenticated: import("rxjs").UnaryFunction<import("rxjs").Observable<Record<string, any>>, import("rxjs").Observable<boolean>>;
|
|
2
|
-
export declare const getUser: import("rxjs").UnaryFunction<import("rxjs").Observable<Record<string, any>>, import("rxjs").Observable<import("./auth.reducer").Profile | undefined>>;
|
|
3
|
-
export declare function getUserSignal(): import("@angular/core").Signal<import("./auth.reducer").Profile | undefined>;
|
|
4
|
-
export declare function getIsAuthenticatedSignal(): import("@angular/core").Signal<boolean | undefined>;
|
package/lib/auth.service.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { User } from '@auth0/auth0-spa-js';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { AuthConfig } from './auth-config';
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
export declare class AuthService {
|
|
6
|
-
private readonly config;
|
|
7
|
-
private readonly auth0;
|
|
8
|
-
constructor(config: AuthConfig);
|
|
9
|
-
isAuthenticated(): Observable<boolean>;
|
|
10
|
-
loginWithRedirect(appState: {
|
|
11
|
-
target: string;
|
|
12
|
-
}): Observable<never>;
|
|
13
|
-
handleRedirectCallback(): Observable<{
|
|
14
|
-
target: string;
|
|
15
|
-
}>;
|
|
16
|
-
getUser(): Observable<User>;
|
|
17
|
-
getAccessToken(): Observable<unknown>;
|
|
18
|
-
logout(): void;
|
|
19
|
-
private checkSession;
|
|
20
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, never>;
|
|
21
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<AuthService>;
|
|
22
|
-
}
|
package/lib/jwt.interceptor.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { HttpHandler, HttpInterceptor, HttpInterceptorFn, HttpRequest } from '@angular/common/http';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class JwtInterceptor implements HttpInterceptor {
|
|
4
|
-
intercept(request: HttpRequest<any>, next: HttpHandler): import("rxjs").Observable<import("@angular/common/http").HttpEvent<unknown>>;
|
|
5
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<JwtInterceptor, never>;
|
|
6
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<JwtInterceptor>;
|
|
7
|
-
}
|
|
8
|
-
export declare const jwtInterceptor: HttpInterceptorFn;
|
package/lib/provide-auth.d.ts
DELETED
package/public-api.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { signIn, signOut, signedIn, signedOut } from './lib/auth.actions';
|
|
2
|
-
export { AuthGuard } from './lib/auth.guard';
|
|
3
|
-
export { AuthModule } from './lib/auth.module';
|
|
4
|
-
export { Profile } from './lib/auth.reducer';
|
|
5
|
-
export { getIsAuthenticatedSignal, getUser, getUserSignal, isAuthenticated } from './lib/auth.selectors';
|
|
6
|
-
export { jwtInterceptor } from './lib/jwt.interceptor';
|
|
7
|
-
export { provideAuth } from './lib/provide-auth';
|