From e3e9264a07cf453a7c02a6dd9f65e1380df5d444 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Mon, 12 Aug 2013 16:36:08 +1000 Subject: [PATCH] 414840 Request.login() throws NPE if username is null --- .../java/org/eclipse/jetty/security/MappedLoginService.java | 3 +++ .../jetty/security/authentication/DeferredAuthentication.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/MappedLoginService.java b/jetty-security/src/main/java/org/eclipse/jetty/security/MappedLoginService.java index 41648d6a6c0..37c72c37ddb 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/MappedLoginService.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/MappedLoginService.java @@ -212,6 +212,9 @@ public abstract class MappedLoginService extends AbstractLifeCycle implements Lo */ public UserIdentity login(String username, Object credentials) { + if (username == null) + return null; + UserIdentity user = _users.get(username); if (user==null) diff --git a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java index d47a65d1fc3..b1a2c6061ec 100644 --- a/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java +++ b/jetty-security/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java @@ -116,6 +116,9 @@ public class DeferredAuthentication implements Authentication.Deferred @Override public Authentication login(String username, Object password, ServletRequest request) { + if (username == null) + return null; + UserIdentity identity = _authenticator.login(username, password, request); if (identity != null) {