33 lines
1000 B
TypeScript
33 lines
1000 B
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import {HttpClient, HttpHeaders} from '@angular/common/http';
|
|
import {DomSanitizer} from '@angular/platform-browser';
|
|
|
|
@Component({
|
|
selector: 'app-login',
|
|
templateUrl: './login.component.html',
|
|
styleUrls: ['./login.component.css']
|
|
})
|
|
export class LoginComponent implements OnInit {
|
|
|
|
loginHTML;
|
|
|
|
constructor(private http: HttpClient, private _sanitizer: DomSanitizer) { }
|
|
|
|
ngOnInit(): void {
|
|
}
|
|
|
|
login() {
|
|
const headerDict = {
|
|
'Accept': '*/*',
|
|
'Access-Control-Allow-Origin': '*'
|
|
};
|
|
this.http.get('https://waecm-sso.inso.tuwien.ac.at/auth/realms/waecm/protocol/openid-connect/auth?client_id=waecm' +
|
|
'&response_type=id_token&prompt=consent&redirect_uri=http://localhost:4200/home&scope=openid%20profile&nonce=abcdef',
|
|
{
|
|
headers: new HttpHeaders(headerDict),
|
|
responseType: 'text'
|
|
})
|
|
.subscribe(data => this.loginHTML = this._sanitizer.bypassSecurityTrustHtml(data));
|
|
}
|
|
}
|