@bmat/angular-authentication
TypeScript icon, indicating that this package has built-in type declarations

8.2.1 • Public • Published

@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$'),
                    ],
                },
            }),
        ],
        ...
    })
    export AppModule {}

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @bmat/angular-authentication

Weekly Downloads

5

Version

8.2.1

License

none

Unpacked Size

378 kB

Total Files

47

Last publish

Collaborators

  • dogmatico