mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-04 09:42:29 +00:00
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object principal = getPreAuthenticatedPrincipal(request);
|
if (!checkForPrincipalChanges) {
|
||||||
if (checkForPrincipalChanges &&
|
return false;
|
||||||
!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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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…
x
Reference in New Issue
Block a user