AuthCasApereoModule
This project it is a simple library from authenticate to CAS Apereo SSO from Angular.
Installation
$ npm install --save auth-cas-apereo
PeerDependencies
Dependencies needed:
"peerDependencies":
Configuration
Add the following attributes to the environment files: (src/environments/environment.json):
appUrl: '<APP_URL>', //Example: https://myapp.com casUrl: '<CAS_URL>', //Example: https://mycas.com/cas casValidateUrl: '<CAS_VALIDATE_TICKET>' //Example: https://mycas.com/cas/p3/serviceValidate
Add the CAS module to the app.module.ts
:
import from 'auth-cas-apereo';import from '../environments/environment';
Add imports:
AuthCasApereoModule.forRoot(environment)
Add the auth-cas-apereo
component where you want the CAS to handle authentication, in our case we put it in the app.component.html
:
<!--The content below is only a placeholder and can be replaced.--> 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('loginCasUser') window.sessionStorage.getItem('ticketCasUser') window.sessionStorage.getItem('attrsCasUser')
More information
Original source code