0.0.29 • Published 3 years ago

@iodp/geodesc-login v0.0.29

Weekly downloads
1
License
-
Repository
-
Last release
3 years ago

GeodescLogin

This provides a common sign in process for all GEODESC web applications.

Setup

  1. Install the package:     npm install @iodp/geodesc-login         OR     yarn add @iodp/geodesc-login

  2. Import GeodescLoginModule into your app's Core module:     import { GeodescLoginModule } from '@iodp/geodesc-login';

    ...     imports:         ...         GeodescLoginModule         ...     ,     ...

  1. Navigate to the GeodescLoginComponent in your routes:     import { GeodescLoginComponent } from '@iodp/geodesc-login';

    const routes: Routes =         ...         { path: 'signin', component: GeodescLoginComponent },         ...     

  1. Add the AuthGuard to any routes that require a user to be signed in:     import { AuthGuard } from '@iodp/geodesc-login';

    const routes: Routes = [         ...         {             path: 'project-templates',             component: ProjectTemplatesComponent,             canActivate: AuthGuard         },         ...     ]

  1. Handle the navigation for after successful sign in. The user will be directed to the 'welcome' url:     const routes: Routes =         ...         { path: 'welcome', pathMatch: 'full', redirectTo: '/project-templates' },         ...     

  2. Include something like the following in your app's startup service:     private _destinationSettings: DestinationObject = {         press F12 to find the needed properties, including if you must select a project     }

    private _encryptSettings: EncryptObject = {         press F12 to find the needed properties     }

    constructor(private login: GeodescLoginService) {         this.login.setDestination(this._destinationSettings);         this.login.setEncryption(this._encryptSettings);     }

  1. Use the public properties and methods from GeodescLoginService:     import { User, GeodescLoginService } from '@iodp/geodesc-login';

    project: string     user: User     privileges: string     user$: Subject\()     errors$: Subject\()

    constructor(private login: GeodescLoginService) {         this.project = this.login.currentProject         this.user = this.login.currentUser         this.user$ = this.login.user$         this.errors$ = this.login.loginMessage$

        // ONLY NEED TO USE ONE OF THESE         this.privileges = this.login.privileges; // this is synchonous but will not have a value until the login call returns         this.checkPrivilege() // this will asynchonously give you the privileges as soon as they are available     }

    checkPrivilege() {         this.login.privilege.subscribe(resp => {             This contains the user's privileges         })     }

    logout() {         this.login.logout();         this.router.navigate('/signin');     }

0.0.23

3 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.28

3 years ago

0.0.29

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago