Revision 51440
Added by Myrto Koukouli about 6 years ago
authentication.service.ts | ||
---|---|---|
11 | 11 |
private router: Router, |
12 | 12 |
private http: Http) {} |
13 | 13 |
|
14 |
private apiUrl : string = apiUrl;
|
|
15 |
private loginUrl : string = `${this.apiUrl}/openid_connect_login`;
|
|
14 |
/*private apiUrl : string = apiUrl;*/
|
|
15 |
/*private loginUrl : string = `${this.apiUrl}/openid_connect_login`;*/
|
|
16 | 16 |
|
17 |
private apiUrl : string = process.env.API_ENDPOINT; |
|
18 |
private loginUrl: string = process.env.AAI_ENDPOINT; |
|
19 |
|
|
17 | 20 |
// store the URL so we can redirect after logging in |
18 | 21 |
public redirectUrl: string; |
19 | 22 |
|
... | ... | |
36 | 39 |
this.isLoggedIn = false; |
37 | 40 |
const baseUrl = appBaseUrl; |
38 | 41 |
console.log('logging out, going to:'); |
39 |
/*console.log(`https://aai.openminted.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo='${window.location}'`); |
|
40 |
window.location.href = `https://aai.openminted.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=${window.location.origin}`;*/ |
|
41 |
console.log(`https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo='${window.location}'`); |
|
42 |
window.location.href = `https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=${window.location.origin}`; |
|
42 |
console.log(`https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=${baseUrl}/landing`); |
|
43 |
window.location.href = `https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=${baseUrl}/landing`; |
|
43 | 44 |
} |
44 | 45 |
|
45 | 46 |
public tryLogin() { |
... | ... | |
82 | 83 |
); |
83 | 84 |
} else { this.isLoggedIn = true; } |
84 | 85 |
console.log(`the current user is: ${sessionStorage.getItem('name')}, ${sessionStorage.getItem('email')}, ${sessionStorage.getItem('role')}`); |
85 |
if(sessionStorage.getItem("state.location")) {
|
|
86 |
if ( sessionStorage.getItem("state.location") ) {
|
|
86 | 87 |
let state = sessionStorage.getItem("state.location"); |
87 | 88 |
sessionStorage.removeItem("state.location"); |
88 |
console.log(`state is ${state}`); |
|
89 |
window.location.href = state; |
|
89 |
console.log(`tried to login - returning to state: ${state}`); |
|
90 |
if (state.includes('landing')) { |
|
91 |
this.router.navigate([this.redirectUrl]); |
|
92 |
} else { |
|
93 |
this.router.navigate([state]); |
|
94 |
} |
|
90 | 95 |
} |
91 | 96 |
} |
92 | 97 |
} |
Also available in: Unified diff
all api methods work!