ekangularbase
Version:
Authentication service for usermanagement(oidc client)
62 lines (54 loc) • 2.37 kB
text/typescript
import { Component, OnInit, Inject } from '@angular/core';
import { Router, ActivatedRoute, Params } from '@angular/router';
import { BlockUI, NgBlockUI } from 'ng-block-ui';
import { AuthService } from '../../auth/auth.service';
import { RouteHandleService } from '../RouteHandle.service';
export class AuthCallbackComponent implements OnInit {
blockUI: NgBlockUI;
baseu: string;
umUrl: string;
constructor( baseUrl: string, private authService: AuthService,
public router: Router, public routehandleservice: RouteHandleService,
Um_Url: string) {
this.baseu = baseUrl;
this.umUrl = Um_Url;
}
ngOnInit() {
if (this.routehandleservice.isRedirectDetailsExist()) {
this.routehandleservice.showblockUi();
} else {
this.blockUI.start('Redirecting to Main Page');
}
console.log('AuthCallbackComponent start');
this.authService.completeAuthentication().then(s => {
if (this.authService.isLoggedIn() === true) {
if (this.authService.isPasswordExpired()) {
location.assign(this.umUrl + '#/change-password?msg=PasswordExpire');
}
// if (!this.routehandleservice.isUrlExist()) {
// location.assign(this.baseu + '/');
// }
// const redirectDetails = this.routehandleservice.getRedirectDetails(0);
// if (redirectDetails !== null) {
// console.log('redirect call back');
// // this.routehandleservice.showblockUi();
// this.authService.ResetFlag();
// this.authService.isRedirect = true;
// location.assign(redirectDetails.fullUrl);
// } else {
this.blockUI.stop();
this.router.navigate(['']);
// }
// this.authService.load();
// location.reload();
// this.router.navigateByUrl('/');
}
}
);
}
}