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,9 +130,16 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends GenericFi
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!checkForPrincipalChanges) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object principal = getPreAuthenticatedPrincipal(request);
|
||||
if (checkForPrincipalChanges &&
|
||||
!currentUser.getName().equals(principal)) {
|
||||
|
||||
if (currentUser.getName().equals(principal)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logger.debug("Pre-authenticated principal has changed to " + principal + " and will be reauthenticated");
|
||||
|
||||
if (invalidateSessionOnPrincipalChange) {
|
||||
|
@ -147,9 +154,6 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends GenericFi
|
|||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the <code>Authentication</code> instance returned by the
|
||||
* authentication manager into the secure context.
|
||||
|
|
Loading…
Reference in New Issue