KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > security > NoAuthentication


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.security;
11
12 import org.mmbase.util.functions.*;
13 import java.util.Map JavaDoc;
14
15 /**
16  * This class is used when no authentication is configured. Every credential is rewarded with a
17  * UserContext object. So every attempt to log in will succeed.
18  *
19  * @author Eduard Witteveen
20  * @version $Id: NoAuthentication.java,v 1.9.2.1 2006/11/09 14:18:52 michiel Exp $
21  * @see UserContext
22  */

23 final public class NoAuthentication extends Authentication {
24
25     static final String JavaDoc TYPE = "no authentication";
26     static final UserContext userContext = new BasicUser(TYPE);
27     // package because NoAuthorization uses it to get the one 'possible context' (which is of course the 'getOwnerField' of the only possible user)
28
// (this is assuming that NoAuthentication is used too, but if not so, that does not matter)
29

30     /**
31      * This method does nothing
32      */

33     protected void load() {
34     }
35
36     /**
37      * Returns always the same object (an user 'anonymous'with rank 'administrator'')
38      * @see UserContext
39      */

40     public UserContext login(String JavaDoc application, Map JavaDoc loginInfo, Object JavaDoc[] parameters) throws SecurityException JavaDoc {
41         return userContext;
42     }
43
44     /**
45      * Users remain valid always.
46      * @return true
47      */

48     public boolean isValid(UserContext usercontext) throws SecurityException JavaDoc {
49         return true;
50     }
51
52     /**
53      * {@inheritDoc}
54      * @since MMBase-1.8
55      */

56     public int getDefaultMethod(String JavaDoc protocol) {
57         return METHOD_DELEGATE;
58     }
59     public String JavaDoc[] getTypes(int method) {
60         return new String JavaDoc[] {TYPE};
61     }
62
63     public Parameters createParameters(String JavaDoc application) {
64         return Parameters.VOID;
65     }
66
67 }
68
Popular Tags