github.com/in4it/ecs-deploy@v0.0.42-0.20240508120354-ed77ff16df25/webapp/src/app/login/saml.component.ts (about)

     1  
     2  import {filter} from 'rxjs/operators';
     3  import { Component, OnInit } from '@angular/core';
     4  
     5  import { Router, ActivatedRoute } from '@angular/router';
     6  
     7  import { AuthService } from '../services/index';
     8  
     9  
    10  
    11  @Component({
    12    selector: 'app-saml',
    13    template: `<i class="fa fa-refresh fa-spin fa-3x fa-fw"></i><span class="sr-only">Loading...</span>`
    14  })
    15  export class LoginSAMLComponent implements OnInit {
    16  
    17    constructor(
    18     private authenticationService: AuthService,
    19     private route: ActivatedRoute,
    20     private router: Router) { }
    21  
    22    ngOnInit() {
    23      this.route.queryParams.pipe(
    24        filter(params => params.token))
    25        .subscribe(params => {
    26          if(params.token) {
    27            this.authenticationService.setToken(params.token)
    28            this.router.navigate(['services']);
    29          } else {
    30            this.router.navigate(['login']);
    31          }
    32      });
    33    }
    34  }