8.2.1 • Published 7 years ago
@bmat/angular-authentication
Licence
—
Version
8.2.1
Deps
1
Size
370 kB
Vulns
0
Weekly
0
@bmat/angular-authentication
This Angular module configures an AuthService that will take care of:
- Parsing callbacks,
- Requesting SSO authentications,
- Polling session data, both to invalidae and renew sessions.
Usage
To enable authentication in the SPA, you need to import the module,
@NgModule({
imports: [
...other imports,
AuthenticationModule.forRoot({
tokenGetter,
webCustomData: Auth0LockOptions,
authOptions: WebAuthOptions,
}),
],
...
})
export AppModule {}
If you need to call an API with the token, you need to add the interceptors
with the same tokenGetter function. The recommended way is to use the dependency
@auth0/angular-jwt:
@NgModule({
imports: [
...other imports,
JwtModule.forRoot({
config: {
tokenGetter,
whitelistedDomains: [
new RegExp('bmat.com'),
new RegExp('localhost'),
new RegExp('^null
Import the JwtModule after AuthenticationModule if you require additional options.
Guards
The module exports AuthenticatedGuard. If the user is not logged when accessing a guarded route, it will call
the logout functions.
),
],
},
}),
],
...
})
export AppModule {}
Import the __INLINE_CODE_2__ after __INLINE_CODE_3__ if you require additional options.
Guards
The module exports __INLINE_CODE_4__. If the user is not logged when accessing a guarded route, it will call the logout functions.