jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1344333 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java
Date Wed, 30 May 2012 16:18:48 GMT
Author: angela
Date: Wed May 30 16:18:47 2012
New Revision: 1344333

URL: http://svn.apache.org/viewvc?rev=1344333&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=1344333&r1=1344332&r2=1344333&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 May 30 16:18:47 2012
@@ -306,15 +306,17 @@ public class LoginModuleImpl implements 
     private String getUserID() {
         // TODO add proper implementation
         String userID = null;
-        Credentials c = credentials.iterator().next();
-        if (c instanceof SimpleCredentials) {
-            userID = ((SimpleCredentials) c).getUserID();
-        } else if (c instanceof GuestCredentials) {
-            userID = "anonymous";
-        } else if (c instanceof ImpersonationCredentials) {
-            Credentials bc = ((ImpersonationCredentials) c).getBaseCredentials();
-            if (bc instanceof SimpleCredentials) {
-                userID = ((SimpleCredentials) bc).getUserID();
+        if (!credentials.isEmpty()) {
+            Credentials c = credentials.iterator().next();
+            if (c instanceof SimpleCredentials) {
+                userID = ((SimpleCredentials) c).getUserID();
+            } else if (c instanceof GuestCredentials) {
+                userID = "anonymous";
+            } else if (c instanceof ImpersonationCredentials) {
+                Credentials bc = ((ImpersonationCredentials) c).getBaseCredentials();
+                if (bc instanceof SimpleCredentials) {
+                    userID = ((SimpleCredentials) bc).getUserID();
+                }
             }
         }
         return userID;



Mime
View raw message