import { Log , User , UserManager } from 'oidc-client' ; import { Constants } from '../helpers/Constants' ; export class AuthService { public userManager : UserManager ; constructor ( ) { const settings = { authority : Constants . stsAuthority , client_id : Constants . clientId , redirect_uri : `${ Constants . clientRoot }signin-callback.html` , silent_redirect_uri : `${ Constants . clientRoot }silent-renew.html` , post_logout_redirect_uri : `${ Constants . clientRoot }` , response_type : 'code' , scope : Constants . clientScope } ; this . userManager = new UserManager ( settings ) ; Log . logger = console ; Log . level = Log . INFO ; } public getUser ( ) { return this . userManager . getUser ( ) ; } public login ( ) { return this . userManager . signinRedirect ( ) ; } public renewToken ( ) { return this . userManager . signinSilent ( ) ; } public logout ( ) { return this . userManager . signoutRedirect ( ) ; } }