Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dariah
dariahsp
Commits
68133fad
Commit
68133fad
authored
Nov 09, 2020
by
Gradl, Tobias
Browse files
5: Implement compatible User/Role behavior from CommonProfile
Task-Url:
#5
parent
64dcc6ee
Pipeline
#17802
passed with stage
in 1 minute and 54 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
dariahsp-core/src/main/java/eu/dariah/de/dariahsp/model/ExtendedUserProfile.java
View file @
68133fad
...
...
@@ -14,6 +14,7 @@ import lombok.NoArgsConstructor;
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
ExtendedUserProfile
extends
CommonProfile
{
private
boolean
transientId
;
private
String
issuerId
;
private
Set
<
String
>
externalRoles
;
private
int
level
;
...
...
dariahsp-core/src/main/java/eu/dariah/de/dariahsp/profiles/LocalProfileCreator.java
View file @
68133fad
...
...
@@ -23,6 +23,7 @@ public class LocalProfileCreator extends BaseProfileCreator implements ProfileCr
return
Optional
.
empty
();
}
ExtendedUserProfile
profile
=
new
ExtendedUserProfile
(
credentials
.
getUserProfile
());
profile
.
setIssuerId
(
"local"
);
this
.
mapAndAssignRoles
(
profile
);
return
Optional
.
ofNullable
(
profile
);
}
...
...
dariahsp-core/src/main/java/eu/dariah/de/dariahsp/profiles/SamlProfileCreator.java
View file @
68133fad
...
...
@@ -22,6 +22,7 @@ import lombok.extern.slf4j.Slf4j;
public
class
SamlProfileCreator
extends
BaseProfileCreator
implements
ProfileCreator
<
SAML2Credentials
>
{
public
static
final
String
EXTERNAL_ROLES_MAPPED_NAME
=
"externalRoles"
;
public
static
final
String
ID_MAPPED_NAME
=
"id"
;
public
static
final
String
ISSUER_ID_NAME
=
"issuerId"
;
private
final
SecurityConfig
securityConfig
;
...
...
@@ -38,6 +39,7 @@ public class SamlProfileCreator extends BaseProfileCreator implements ProfileCre
ExtendedUserProfile
profile
=
new
ExtendedUserProfile
(
credentials
.
getUserProfile
());
this
.
assignExternalRoles
(
profile
);
this
.
setIdPersistenceInfo
(
profile
);
this
.
setIssuerId
(
profile
);
this
.
mapAndAssignRoles
(
profile
);
return
Optional
.
ofNullable
(
profile
);
}
...
...
@@ -61,6 +63,17 @@ public class SamlProfileCreator extends BaseProfileCreator implements ProfileCre
}
profile
.
setTransientId
(
transientId
);
}
private
void
setIssuerId
(
ExtendedUserProfile
profile
)
{
try
{
Object
issuerId
=
profile
.
getAuthenticationAttribute
(
ISSUER_ID_NAME
);
if
(
issuerId
!=
null
)
{
profile
.
setIssuerId
(
issuerId
.
toString
());
}
}
catch
(
Exception
e
)
{
log
.
warn
(
"Unable to issuerId of the profile"
,
e
);
}
}
private
void
assignExternalRoles
(
ExtendedUserProfile
profile
)
{
try
{
...
...
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