Improve login
[lgpl/argeo-commons.git] / org.argeo.security.core / src / org / argeo / security / jcr / jackrabbit / JackrabbitUserAdminService.java
index 711c9d598e031f50069bd624bface214fac2638c..c0b4b4b1508a29def68a681eadcd873953592a3c 100644 (file)
@@ -22,6 +22,7 @@ import org.apache.jackrabbit.core.security.authentication.CryptedSimpleCredentia
 import org.argeo.ArgeoException;
 import org.argeo.jcr.JcrUtils;
 import org.argeo.jcr.UserJcrUtils;
+import org.argeo.security.NodeAuthenticationToken;
 import org.argeo.security.UserAdminService;
 import org.argeo.security.jcr.JcrSecurityModel;
 import org.argeo.security.jcr.JcrUserDetails;
@@ -300,7 +301,7 @@ public class JackrabbitUserAdminService implements UserAdminService,
        // AUTHENTICATION PROVIDER
        public synchronized Authentication authenticate(
                        Authentication authentication) throws AuthenticationException {
-               UsernamePasswordAuthenticationToken siteAuth = (UsernamePasswordAuthenticationToken) authentication;
+               NodeAuthenticationToken siteAuth = (NodeAuthenticationToken) authentication;
                String username = siteAuth.getName();
                if (!(siteAuth.getCredentials() instanceof char[]))
                        throw new ArgeoException("Only char array passwords are supported");
@@ -334,8 +335,8 @@ public class JackrabbitUserAdminService implements UserAdminService,
                try {
                        JcrUserDetails userDetails = loadJcrUserDetails(adminSession,
                                        username);
-                       UsernamePasswordAuthenticationToken authenticated = new UsernamePasswordAuthenticationToken(
-                                       siteAuth, "", userDetails.getAuthorities());
+                       NodeAuthenticationToken authenticated = new NodeAuthenticationToken(
+                                       siteAuth, userDetails.getAuthorities());
                        authenticated.setDetails(userDetails);
                        return authenticated;
                } catch (RepositoryException e) {