]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.cms/src/org/argeo/cms/auth/UserAdminLoginModule.java
Fix exception when providing bad credentials
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / auth / UserAdminLoginModule.java
index 53e48e8c1ea4089eb13e7d5bd336c98619dc60c9..db677f57e13dc7f9a5715459dc532248ac054f2f 100644 (file)
@@ -70,6 +70,9 @@ public class UserAdminLoginModule implements LoginModule, AuthConstants {
                        } catch (IOException e) {
                                throw new LoginException("Cannot handle http callback: "
                                                + e.getMessage());
+                       } catch (ThreadDeath e) {
+                               throw new ThreadDeathLoginException(
+                                               "Callbackhandler thread died", e);
                        } catch (UnsupportedCallbackException e) {
                                return false;
                        }
@@ -123,7 +126,7 @@ public class UserAdminLoginModule implements LoginModule, AuthConstants {
        public boolean commit() throws LoginException {
                Authorization authorization = subject
                                .getPrivateCredentials(Authorization.class).iterator().next();
-               if (request != null) {
+               if (request != null && authorization.getName() != null) {
                        request.setAttribute(HttpContext.REMOTE_USER,
                                        authorization.getName());
                        request.setAttribute(HttpContext.AUTHORIZATION, authorization);