Skip to content

Commit 8887c50

Browse files
committed
concord-server, oidc, pfed-sso: improve handling of user sessions without UserPrincipal
1 parent c7ed2a0 commit 8887c50

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

server/impl/src/main/java/com/walmartlabs/concord/server/security/github/GithubRealm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
7878
@WithTimer
7979
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
8080
UserPrincipal p = principals.oneByType(UserPrincipal.class);
81-
if (!REALM_NAME.equals(p.getRealm())) {
81+
if (p == null || !REALM_NAME.equals(p.getRealm())) {
8282
return null;
8383
}
8484

server/impl/src/main/java/com/walmartlabs/concord/server/security/internal/InternalRealm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
4242
@Override
4343
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
4444
UserPrincipal p = principals.oneByType(UserPrincipal.class);
45-
if (!REALM_NAME.equals(p.getRealm())) {
45+
if (p == null || !REALM_NAME.equals(p.getRealm())) {
4646
return null;
4747
}
4848

server/plugins/oidc/src/main/java/com/walmartlabs/concord/server/plugins/oidc/OidcRealm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
123123
@Override
124124
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
125125
UserPrincipal p = principals.oneByType(UserPrincipal.class);
126-
if (!REALM_NAME.equals(p.getRealm())) {
126+
if (p == null || !REALM_NAME.equals(p.getRealm())) {
127127
return null;
128128
}
129129

server/plugins/pfed-sso/src/main/java/com/walmartlabs/concord/server/plugins/pfedsso/SsoRealm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
9999
@Override
100100
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
101101
UserPrincipal p = principals.oneByType(UserPrincipal.class);
102-
if (!REALM_NAME.equals(p.getRealm())) {
102+
if (p == null || !REALM_NAME.equals(p.getRealm())) {
103103
return null;
104104
}
105105

0 commit comments

Comments
 (0)