jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1346782 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java
Date Wed, 06 Jun 2012 08:43:42 GMT
Author: angela
Date: Wed Jun  6 08:43:42 2012
New Revision: 1346782

URL: http://svn.apache.org/viewvc?rev=1346782&view=rev
Log:
 OAK-91 - Implement Authentication Support (WIP)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java?rev=1346782&r1=1346781&r2=1346782&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java
Wed Jun  6 08:43:42 2012
@@ -139,8 +139,8 @@ public class LoginModuleImpl implements 
     public boolean login() throws LoginException {
         // TODO
         credentials = getCredentials();
-        principals = getPrincipals();
         userID = getUserID();
+        principals = getPrincipals(userID);
 
         Authentication authentication = new AuthenticationImpl(userID);
         boolean success = authenticate(authentication);
@@ -255,24 +255,12 @@ public class LoginModuleImpl implements 
         return cds;
     }
 
-    private static Principal getPrincipal(Credentials credentials, PrincipalProvider principalProvider)
{
-        Principal principal = null;
-        if (credentials instanceof SimpleCredentials) {
-            String userID = ((SimpleCredentials) credentials).getUserID();
-            principal = principalProvider.getPrincipal(userID); // FIXME
-        } else if (credentials instanceof GuestCredentials) {
-            principal = principalProvider.getPrincipal("anonymous"); // FIXME
-        }
-
-        return principal;
-    }
-
-    private Set<Principal> getPrincipals() {
+    private Set<Principal> getPrincipals(String userID) {
         Set<Principal> principals = new HashSet<Principal>();
         PrincipalProvider principalProvider = getPrincipalProvider();
         if (principalProvider != null) {
             for (Credentials creds : credentials) {
-                Principal p = getPrincipal(creds, principalProvider);
+                Principal p = principalProvider.getPrincipal(userID); // TODO FIXME
                 if (p != null) {
                     principals.add(p);
                     principals.addAll(principalProvider.getGroupMembership(p));



Mime
View raw message