Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
feudal
feudalWebpage
Commits
74588c61
Commit
74588c61
authored
Jan 23, 2018
by
Lukas Burgey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a cookie to set idp preference
parent
0dd7504c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
12 deletions
+14
-12
src/app/login/login.component.ts
src/app/login/login.component.ts
+5
-1
src/app/user.service.ts
src/app/user.service.ts
+9
-11
No files found.
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
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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