fixed null pointer exception when principal is null
This commit is contained in:
parent
f2f508ac2e
commit
115f95d90e
1 changed files with 2 additions and 2 deletions
|
@ -153,14 +153,14 @@ public class CatalinaSamlSessionStore implements SamlSessionStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericPrincipal principal = (GenericPrincipal) session.getPrincipal();
|
GenericPrincipal principal = (GenericPrincipal) session.getPrincipal();
|
||||||
if (samlSession.getPrincipal().getName().equals(principal.getName()))
|
|
||||||
// in clustered environment in JBossWeb, principal is not serialized or saved
|
// in clustered environment in JBossWeb, principal is not serialized or saved
|
||||||
if (principal == null) {
|
if (principal == null) {
|
||||||
principal = principalFactory.createPrincipal(request.getContext().getRealm(), samlSession.getPrincipal(), samlSession.getRoles());
|
principal = principalFactory.createPrincipal(request.getContext().getRealm(), samlSession.getPrincipal(), samlSession.getRoles());
|
||||||
session.setPrincipal(principal);
|
session.setPrincipal(principal);
|
||||||
session.setAuthType("KEYCLOAK-SAML");
|
session.setAuthType("KEYCLOAK-SAML");
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else if (samlSession.getPrincipal().getName().equals(principal.getName())){
|
||||||
if (!principal.getUserPrincipal().getName().equals(samlSession.getPrincipal().getName())) {
|
if (!principal.getUserPrincipal().getName().equals(samlSession.getPrincipal().getName())) {
|
||||||
throw new RuntimeException("Unknown State");
|
throw new RuntimeException("Unknown State");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue