6.2.0 • Published 2 years ago

@kreadyf/auth-angular v6.2.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

KDYF-AUTH-ANGULAR

Versions

Angular@kreadyf/auth-angular
>=9.0.0 <10.0.0v5.x
>=8.0.0 <9.0.0v5.x

Getting started

Step 1: Install @kreadyf/auth-angular:

NPM

npm install --save @kreadyf/auth-angular

YARN

yarn add @kreadyf/auth-angular

Step 2: Configuration environment:

You have three options to login, you can use just one or all

import {ProviderType} from '@kreadyf/auth-angular';

export const environment = {
  production: false,
  ...
  kdyfAuth: [
    {
      providerId: 'test1',
      providerType: ProviderType.AzureAd,
      authConfig: {
        loginUrl: 'https://my-server1/api/auth/'
      }
    },
    {
      providerId: 'test2',
      providerType: ProviderType.Eikon,
      authConfig: {
        loginUrl: 'https://my-server2/api/auth/'
      }
    },
    {
      providerId: 'test3',
      providerType: ProviderType.JwsSimple,
      authConfig: {
        loginUrl: 'https://my-server3/api/auth/'
      }
    }
  ]
};

Step 3: Import AuthModule:

import {AuthModule} from '@kreadyf/auth-angular';

@NgModule({
  declarations: [AppComponent],
  imports: [AuthModule.forRoot(environment.kdyfAuth)],
  bootstrap: [AppComponent]
})
export class AppModule {}

Basic login example:

import {ProviderType} from '@kreadyf/auth-angular';
import * as authActions from '@kreadyf/auth-angular';
import {AuthActionTypes} from '@kreadyf/auth-angular';

    // Send data to login
    this.store.dispatch(
      new authActions.Login({
        credentials: {username: my-email, password: my-password},
        typeAuth: ProviderType.JwsSimple
    }));

    // Listen success login
    this.actions.pipe(
      filter(s => s.type === AuthActionTypes.AuthenticationSuccess),
      tap(() => ...)
    ).subscribe();

    // Listen failure login
    this.actions.pipe(
      filter(s => s.type === AuthActionTypes.AuthenticationFailure),
      tap(s => ...)
    ).subscribe();

Contributing

Contributions are welcome.

Inspiration

This component is inspired by KREADYF SRL

6.2.0

2 years ago

6.1.0

4 years ago

6.0.0

4 years ago

5.2.0

4 years ago

5.1.1

4 years ago

5.1.0

4 years ago

5.0.0

4 years ago

4.6.0

4 years ago

4.5.0

4 years ago

4.4.0

4 years ago

4.3.2

4 years ago

4.3.1

4 years ago

4.3.0

4 years ago

4.1.0

4 years ago

2.0.0

4 years ago

1.0.2

4 years ago