mdds-angular-auth
TypeScript icon, indicating that this package has built-in type declarations

0.7.110 • Public • Published

Augular Authentication and Authorization Module

Usage:

  1. Add 'mdds-angular-auth" package as dependency in your project in file package.json:

For example:

"dependencies": { "@angular/common": "^6.0.3", "@angular/core": "^6.0.3", "@angular/forms": "^6.0.3", "@angular/http": "^6.0.3", "@angular/router": "^6.0.3", "rxjs": "^6.0.0", "zone.js": "^0.8.26", ... ... "mdds-angular-auth": "" },

  1. Create a auth.config.ts to add the following two configuration variables required by 'mdds-angular-auth' logic:

export const authentication_login_page_uri: string = '/auth/login'; export const authentication_server_root_uri: string = '/api/auth';

  1. Declare two providers in your app.module.ts:

import { AUTHENTICATION_LOGIN_PAGE_URI, AUTHENTICATION_SERVER_ROOT_URI } from 'mdds-angular-auth'; import { authentication_login_page_uri, authentication_server_root_uri } from './auth.config'; ... @NgModule( ... providers: [ ... { provide: AUTHENTICATION_LOGIN_PAGE_URI, useValue: authentication_login_page_uri }, { provide: AUTHENTICATION_SERVER_ROOT_URI, useValue: authentication_server_root_uri }

] ...

  1. Import 'AuthenticationModule' in app.module.ts:

import { AuthenticationModule } from 'mdds-angular-auth'; ...

@NgModule( ... imports: [ ... AuthenticationModule ], ...

  1. Use AuthGuard to application routers:

import {AuthGuard} from 'mdds-angular-auth'; ... routes: Routes = [ { path: 'path/to/guard', component: ComponentToGuard, canActivate: [AuthGuard], } ... ] ...

  1. Use the authenticaiton icon in your HTML:

app.component.html

...

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.7.1102latest

Version History

VersionDownloads (Last 7 Days)Published
0.7.1102
0.7.1060
0.7.1050
0.7.1000
0.7.800
0.7.650
0.7.610
0.7.600
0.7.200
0.7.100
0.7.10
0.7.00
0.6.500
0.6.00
0.2.20
0.2.10
0.2.00
0.1.10
0.1.00

Package Sidebar

Install

npm i mdds-angular-auth

Weekly Downloads

2

Version

0.7.110

License

MIT

Unpacked Size

859 kB

Total Files

68

Last publish

Collaborators

  • xibinliu