SEC-1788: Avoid unnecessary call to getPreAuthenticatedPrincipal() in AbstractPreAuthenticatedProcessingFilter when not checking for principal changes is not enabled.
This commit is contained in:
parent
7399c9a7a5
commit
0c2a950fa0
|
@ -130,24 +130,28 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends GenericFi
|
|||
return true;
|
||||
}
|
||||
|
||||
Object principal = getPreAuthenticatedPrincipal(request);
|
||||
if (checkForPrincipalChanges &&
|
||||
!currentUser.getName().equals(principal)) {
|
||||
logger.debug("Pre-authenticated principal has changed to " + principal + " and will be reauthenticated");
|
||||
|
||||
if (invalidateSessionOnPrincipalChange) {
|
||||
HttpSession session = request.getSession(false);
|
||||
|
||||
if (session != null) {
|
||||
logger.debug("Invalidating existing session");
|
||||
session.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
if (!checkForPrincipalChanges) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
Object principal = getPreAuthenticatedPrincipal(request);
|
||||
|
||||
if (currentUser.getName().equals(principal)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logger.debug("Pre-authenticated principal has changed to " + principal + " and will be reauthenticated");
|
||||
|
||||
if (invalidateSessionOnPrincipalChange) {
|
||||
HttpSession session = request.getSession(false);
|
||||
|
||||
if (session != null) {
|
||||
logger.debug("Invalidating existing session");
|
||||
session.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue