Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
feudal
feudalWebpage
Commits
74588c61
Commit
74588c61
authored
Jan 23, 2018
by
Lukas Burgey
Browse files
Use a cookie to set idp preference
parent
0dd7504c
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/app/login/login.component.ts
View file @
74588c61
...
...
@@ -19,10 +19,14 @@ export class LoginComponent {
public
dialog
:
DialogService
,
public
http
:
HttpClient
,
)
{
this
.
selectedIdP
=
this
.
userService
.
getIdPPreference
();
this
.
userService
.
getAuthInfo
().
subscribe
(
data
=>
{
this
.
idps
=
data
[
'
idps
'
];
this
.
selectedIdP
=
data
[
'
default
'
];
if
(
!
this
.
selectedIdP
)
{
this
.
selectedIdP
=
data
[
'
default
'
];
}
}
);
}
...
...
src/app/user.service.ts
View file @
74588c61
...
...
@@ -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
=>
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment