Update of /var/cvs/src/org/mmbase/security
In directory james.mmbase.org:/tmp/cvs-serv10296

Modified Files:
        BasicUser.java NoAuthentication.java 
Log Message:
  MMB-1540


See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/security
See also: http://www.mmbase.org/jira/browse/MMB-1540


Index: BasicUser.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/security/BasicUser.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- BasicUser.java      19 Nov 2007 15:32:15 -0000      1.5
+++ BasicUser.java      17 Mar 2008 15:37:59 -0000      1.6
@@ -23,16 +23,20 @@
  * although this is possible.
  *
  * @author Eduard Witteveen
- * @version $Id: BasicUser.java,v 1.5 2007/11/19 15:32:15 michiel Exp $
+ * @version $Id: BasicUser.java,v 1.6 2008/03/17 15:37:59 michiel Exp $
  */
 public class BasicUser implements UserContext {
     private static final Logger log = 
Logging.getLoggerInstance(BasicUser.class);
 
     protected final String authenticationType;
-
+    private final String identifier;
 
     public BasicUser(String authenticationType) {
+        this(authenticationType, "anonymous");
+    }
+    public BasicUser(String authenticationType, String identifier) {
         this.authenticationType = authenticationType;
+        this.identifier = identifier;
     }
 
     /**
@@ -42,7 +46,7 @@
      * @return A unique identifier for this user.
      */
     public String getIdentifier() {
-        return "anonymous";
+        return identifier;
     }
 
     /**


Index: NoAuthentication.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/security/NoAuthentication.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- NoAuthentication.java       9 Nov 2006 14:19:37 -0000       1.10
+++ NoAuthentication.java       17 Mar 2008 15:37:59 -0000      1.11
@@ -17,7 +17,7 @@
  * UserContext object. So every attempt to log in will succeed.
  *
  * @author Eduard Witteveen
- * @version $Id: NoAuthentication.java,v 1.10 2006/11/09 14:19:37 michiel Exp $
+ * @version $Id: NoAuthentication.java,v 1.11 2008/03/17 15:37:59 michiel Exp $
  * @see UserContext
  */
 final public class NoAuthentication extends Authentication {
@@ -38,8 +38,13 @@
      * @see UserContext
      */
     public UserContext login(String application, Map loginInfo, Object[] 
parameters) throws SecurityException {
+        String userName = loginInfo == null ? null : (String) 
loginInfo.get(AuthenticationData.PARAMETER_USERNAME.getName());
+        if (userName != null) {
+            return new BasicUser(TYPE, userName);
+        } else {
         return userContext;
     }
+    }
 
     /**
      * Users remain valid always. 
@@ -61,7 +66,7 @@
     }
 
     public Parameters createParameters(String application) {
-        return Parameters.VOID;
+        return new AutodefiningParameters();
     }
 
 }
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to