Commit 74588c61 authored by Lukas Burgey's avatar Lukas Burgey

Use a cookie to set idp preference

parent 0dd7504c
......@@ -19,11 +19,15 @@ export class LoginComponent {
public dialog: DialogService,
public http: HttpClient,
) {
this.selectedIdP = this.userService.getIdPPreference();
this.userService.getAuthInfo().subscribe(
data => {
this.idps = data['idps'];
if (!this.selectedIdP) {
this.selectedIdP = data['default'];
}
}
);
}
}
......@@ -91,19 +91,12 @@ export class UserService {
);
}
public backendOperational(): Observable<boolean> {
return this.http.get('/backend/api/operational').map(
(data) => {
return data['operational'];
},
(err) => {
return false;
}
);
public setIdPPreference(idpId: number) {
this.cookieService.set('idp_id', String(idpId));
}
public login(idpId: number) {
window.location.href = 'https://hdf-portal.data.kit.edu/backend/auth/v1/request/?idp=' + idpId;
public getIdPPreference(): number {
return Number(this.cookieService.get('idp_id'));
}
public updateData(data: any) {
......@@ -169,6 +162,11 @@ export class UserService {
this.updateState();
}
public login(idpId: number) {
this.setIdPPreference(idpId);
window.location.href = 'https://hdf-portal.data.kit.edu/backend/auth/v1/request';
}
public logout() {
this.http.post('/backend/auth/v1/logout/', {}).subscribe(
data => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment