@airtradeit/authentication
v3.0.0
Published
This library shares Authentication which can be used for OM and FF applications.
Keywords
Readme
Authentication
This library shares Authentication which can be used for OM and FF applications.
Example usage
- Create
ConfigLoaderServiceand then use it in appModule:
@Injectable()
export class ConfigLoaderService implements ConfigLoader {
constructor(@Inject(ConfigService) private _configService: ConfigService) {}
getWebApi(): string {
return this._configService.getProperty<string>('WEB_API');
}
...
}- In app.module.ts add code snippet below to the imports:
import { AuthenticationModule, ConfigLoader, LocalStorageLoader } from '@airtradeit/authentication';
@NgModule({
...,
imports: [
...,
AuthenticationModule.forRoot({
configServiceLoader: {
provide: ConfigLoader,
useFactory: (configService: ConfigService): ConfigLoaderService => new ConfigLoaderService(configService),
deps: [ConfigService],
},
localStorageLoader: {
provide: LocalStorageLoader,
useFactory: (): LocalStorageService => new LocalStorageService(),
},
})
],
})Code scaffolding
Run ng generate component component-name --project authentication to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project authentication.
Note: Don't forget to add
--project authenticationor else it will be added to the default project in yourangular.jsonfile.
Build
Run ng build --prod authentication to build the project. The build artifacts will be stored in the dist/ directory.
Publishing
After building your library with ng build --prod authentication, go to the dist folder cd dist/authentication and run npm publish.
Running unit tests
Run jest to execute the unit tests via [Jest]
