Procházet zdrojové kódy

SEC-663: Added null check for pre-authenticated principal value (and skip authentication attempt if null).

Luke Taylor před 17 roky
rodič
revize
600ab04cc7

+ 8 - 0
core/src/main/java/org/springframework/security/ui/preauth/AbstractPreAuthenticatedProcessingFilter.java

@@ -74,6 +74,14 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends SpringSec
         Object principal = getPreAuthenticatedPrincipal(httpRequest);
         Object credentials = getPreAuthenticatedCredentials(httpRequest);
 
+        if (principal == null) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("No pre-authenticated principal found in request");
+            }
+
+            return;            
+        }
+
         if (logger.isDebugEnabled()) {
             logger.debug("preAuthenticatedPrincipal = " + principal + ", trying to authenticate");
         }