org.mmbase.security
Class NoAuthentication

java.lang.Object
  extended by org.mmbase.security.Configurable
      extended by org.mmbase.security.Authentication
          extended by org.mmbase.security.NoAuthentication
All Implemented Interfaces:
AuthenticationData

public final class NoAuthentication
extends Authentication

This class is used when no authentication is configured. Every credential is rewarded with a UserContext object. So every attempt to log in will succeed.

Version:
$Id: NoAuthentication.java 41989 2010-04-20 16:45:39Z michiel $
Author:
Eduard Witteveen
See Also:
UserContext

Field Summary
(package private) static String TYPE
           
(package private) static UserContext userContext
           
 
Fields inherited from class org.mmbase.security.Authentication
attributes, key, PARAMETERS_ANONYMOUS, PARAMETERS_NAME_PASSWORD, PARAMETERS_USERS
 
Fields inherited from class org.mmbase.security.Configurable
configResource, configWatcher, manager
 
Fields inherited from interface org.mmbase.security.AuthenticationData
METHOD_ANONYMOUS, METHOD_ASIS, METHOD_DEFAULT, METHOD_DELEGATE, METHOD_HTTP, METHOD_LOGINPAGE, METHOD_LOGOUT, METHOD_PAGELOGON, METHOD_SESSIONDELEGATE, METHOD_SESSIONLOGON, METHOD_UNSET, PARAMETER_AUTHENTICATE, PARAMETER_LOGOUT, PARAMETER_PASSWORD, PARAMETER_RANK, PARAMETER_SESSIONNAME, PARAMETER_USERNAME, PARAMETER_USERNAMES, STORES_CONTEXT_IN_OWNER, STRINGS
 
Constructor Summary
NoAuthentication()
           
 
Method Summary
 Parameters createParameters(String application)
          For a given authentication type returns a parameters object to fill with credentials.
 int getDefaultMethod(String protocol)
          The security implementation can override a default method.
 String[] getTypes(int method)
          For a given method, returns the available 'applications'.
 boolean isValid(UserContext usercontext)
          Users remain valid always.
protected  void load()
          This method does nothing
 UserContext login(String application, Map loginInfo, Object[] parameters)
          Returns always the same object (an user 'anonymous'with rank 'administrator'')
 
Methods inherited from class org.mmbase.security.Authentication
getAttribute, getKey, getMethod, getMethod, getNode, getTypes, getUserBuilder
 
Methods inherited from class org.mmbase.security.Configurable
load
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE

static final String TYPE
See Also:
Constant Field Values

userContext

static final UserContext userContext
Constructor Detail

NoAuthentication

public NoAuthentication()
Method Detail

load

protected void load()
This method does nothing

Specified by:
load in class Configurable

login

public UserContext login(String application,
                         Map loginInfo,
                         Object[] parameters)
                  throws SecurityException
Returns always the same object (an user 'anonymous'with rank 'administrator'')

Specified by:
login in class Authentication
Parameters:
application - A String that further specifies the login method (one implementation could handle more then one methods) A typical value might be 'username/password'. Possible values are returned by Authentication.getTypes(). This is also called 'authentication', or '(authentication) type' in several contextes.
loginInfo - A Map containing the credentials or other objects which might be used to obtain them (e.g. request/response objects). It might also be 'null', in which case your implementation normally should return the 'anonymous' user (or null, if no such user can be defined). This Map can (or must) be supplied by Authentication.createParameters(java.lang.String) (using the setter-methods and the Parameters.toMap(java.util.Map) method of the resulting Parameters object).
parameters - A list of optional parameters, may also (and will often) be null.
Returns:
null if no valid credentials were supplied, a (perhaps new) UserContext if login succeeded.
Throws:
SecurityException - When something strange happened, or authentication was unsuccessful.
See Also:
UserContext

isValid

public boolean isValid(UserContext usercontext)
                throws SecurityException
Users remain valid always.

Parameters:
usercontext - The UserContext of which we want to know the rights
Returns:
true
Throws:
SecurityException - When something strange happened

getDefaultMethod

public int getDefaultMethod(String protocol)
The security implementation can override a default method. The default default method (as implemented in Authentication for the 'http' protocol is HTTP (which means that basic authentication of the http protocol can be used), but may not be feasible for every implementation (it is e.g. useless if the security implementation does not have name/password authentication).

Specified by:
getDefaultMethod in interface AuthenticationData
Overrides:
getDefaultMethod in class Authentication
Parameters:
protocol - For which protocol or null, which means 'for HTTP/1.1'.
Since:
MMBase-1.8

getTypes

public String[] getTypes(int method)
Description copied from class: Authentication

For a given method, returns the available 'applications'. The first one can be used as the default.

Typically for the method AuthenticationData.METHOD_ANONYMOUS at least 'anonymous' must be returned, and for AuthenticationData.METHOD_DELEGATE at least 'class'. Everything else is optional, because are not generic.

Specified by:
getTypes in interface AuthenticationData
Overrides:
getTypes in class Authentication

createParameters

public Parameters createParameters(String application)
Description copied from class: Authentication
For a given authentication type returns a parameters object to fill with credentials. Parameters.toMap(java.util.Map) can be used as the second argument for Authentication.login(java.lang.String, java.util.Map, java.lang.Object[]) Given a certain 'application' this will return a Parameters which tells you exactly which parameters you can and must supply to Authentication.login(String, java.util.Map, Object[]).

Specified by:
createParameters in interface AuthenticationData
Overrides:
createParameters in class Authentication


MMBase 2.0-SNAPSHOT - null