Skip to content

Commit baea49d

Browse files
committed
[ELY-2872] Security roles lost following failover
1 parent 04e4ddc commit baea49d

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

http/sso/src/main/java/org/wildfly/security/http/util/sso/DefaultSingleSignOn.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.AbstractMap.SimpleImmutableEntry;
2424
import java.util.Collections;
2525
import java.util.Map;
26+
import java.util.Set;
2627

2728
import org.wildfly.security.auth.server.SecurityIdentity;
2829
import org.wildfly.security.cache.CachedIdentity;
@@ -70,6 +71,11 @@ public SecurityIdentity getIdentity() {
7071
return this.entry.getCachedIdentity().getSecurityIdentity();
7172
}
7273

74+
@Override
75+
public Set<String> getRoles() {
76+
return this.entry.getCachedIdentity().getRoles();
77+
}
78+
7379
@Override
7480
public void setIdentity(SecurityIdentity identity) {
7581
// Only set cached identity if it has not already been set

http/sso/src/main/java/org/wildfly/security/http/util/sso/DefaultSingleSignOnSession.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,6 @@ private static CachedIdentity getCachedIdentity(SingleSignOn sso) {
247247
String mechanism = sso.getMechanism();
248248
boolean programmatic = sso.isProgrammatic();
249249
SecurityIdentity identity = sso.getIdentity();
250-
return (identity != null) ? new CachedIdentity(mechanism, programmatic, identity) : new CachedIdentity(mechanism, programmatic, new NamePrincipal(sso.getName()));
250+
return (identity != null) ? new CachedIdentity(mechanism, programmatic, identity) : new CachedIdentity(mechanism, programmatic, new NamePrincipal(sso.getName()), sso.getRoles());
251251
}
252252
}

http/sso/src/main/java/org/wildfly/security/http/util/sso/ImmutableSingleSignOn.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import java.net.URI;
2121
import java.util.Map;
22+
import java.util.Set;
2223

2324
import org.wildfly.security.auth.server.SecurityIdentity;
2425

@@ -58,6 +59,12 @@ public interface ImmutableSingleSignOn {
5859
*/
5960
SecurityIdentity getIdentity();
6061

62+
/**
63+
* Returns the roles of the principal associated with this single sign-on entry.
64+
* @return principal roles
65+
*/
66+
Set<String> getRoles();
67+
6168
/**
6269
* Returns the participants associated with this single sign-on entry.
6370
* @return an unmodifiable mapping of application identifier to a tuple of the session identifier and request URI

0 commit comments

Comments
 (0)