Skip to content

Commit

Permalink
authentication principal reset fix (when principal is already authent…
Browse files Browse the repository at this point in the history
…icated)
  • Loading branch information
KaterynaHonchar committed Dec 7, 2022
1 parent 252afb7 commit 0333e4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,8 @@ public boolean isAnonymous() {
}
return false;
}

public boolean hasSucceededAuthentication() {
return getAuthentications().stream().anyMatch(auth -> AuthenticationModuleState.SUCCESSFULLY.equals(auth.getState()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ protected void processAuthentication(ServletRequest req) {
if (moduleAuthentication != null && moduleAuthentication.getAuthentication() == null) {
Authentication authentication = createBasicAuthentication((HttpServletRequest) req);
moduleAuthentication.setAuthentication(authentication);
mpAuthentication.setPrincipal(authentication.getPrincipal());
if (!mpAuthentication.hasSucceededAuthentication()) {
mpAuthentication.setPrincipal(authentication.getPrincipal());
}
}
}
}
Expand Down

0 comments on commit 0333e4a

Please sign in to comment.