AuthCasModule
This project it is a simple library from authenticate to CAS SSO from Angular.
Installation
$ npm install --save auth-cas-mod
PeerDependencies
Dependencies needed:
"peerDependencies":
Configuration
Add the following attributes to the environment files: (src/environments/environment.json):
app_url: '<APP_URL>', //Example: https://myapp.com cas_url: '<CAS_URL>', //Example: https://mycas.com/cas cas_validate_url: '<CAS_VALIDATE_TICKET>' //Example: https://mycas.com/cas/serviceValidate
Add the CAS module to the app.module.ts
:
import from 'auth-cas-mod';import from '../environments/environment';
Add imports:
AuthCasModModule.forRoot(environment)
Add the cas-auth-cas-mod
component where you want the CAS to handle authentication, in our case we put it in the app.component.html
:
Welcome to {{ title }}! Here are some links to help you start: Tour of Heroes CLI Documentation Angular blog
Get User Logged in
To get logged in user use the SessionStorage:
window.sessionStorage.getItem('loginUser') window.sessionStorage.getItem('ticketUser')