AuthLib
This library was generated with Angular CLI version 8.2.11.
Purpose: The Auth service provides four main components. The only "required" component is AuthService, as the others depend on it.
-
AuthService: Has an
authenticated()
method which checks local storage for the presence of authentication cookies, calls Okta with the cookies, and returns the cookie if they are valid. Note that this service will automatically refresh thesessionId
cookie if a refresh token is present -
LoggedInGuard: Will prevent a route from being navigated to if the user doesn't have valid cookies set. Will redirect to the login page instead.
-
ManageCookiesInterceptorService: This is Angular middleware which will set the Crds auth cookies on every request.
-
ReactiveAuthService: Will redirect the user to the login page if the auth cookie is expired or deleted.
Code scaffolding
Run ng generate component component-name --project auth-lib
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project auth-lib
.
Note: Don't forget to add
--project auth-lib
or else it will be added to the default project in yourangular.json
file.
Build
Run ng build auth-lib
to build the project. The build artifacts will be stored in the dist/
directory.
Publishing
After building your library with ng build auth-lib
, go to the dist folder cd dist/auth-lib
and run npm publish
.
Running unit tests
Run ng test auth-lib
to execute the unit tests via Karma.
Further help
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.