org.mmbase.security
Class BasicUser

Package class diagram package BasicUser
java.lang.Object
  extended by org.mmbase.security.BasicUser
All Implemented Interfaces:
Serializable, Comparable<Object>, UserContext

public class BasicUser
extends Object
implements UserContext, Comparable<Object>

A UserContext object is the result of an authentication, on which authorization can be based. Normally your authorization/authentication implementation will also provide an extension to this class. This default implementation is the most simple one, actually implementing 'no authorization' (because the rank is fixed to 'administrator'). This class is not necessarily also the container class for the client's credentials, although this is possible.

Version:
$Id: BasicUser.java 45000 2011-01-21 23:27:04Z michiel $
Author:
Eduard Witteveen
See Also:
Serialized Form

Field Summary
protected  Authentication authentication
           
protected  String authenticationType
           
 
Constructor Summary
BasicUser(Authentication auth, String authenticationType, String identifier)
           
 
Method Summary
 int compareTo(Object o)
           
 boolean equals(Object o)
           
 String getAuthenticationType()
          Returns the original authentication type as specified in getCloud
 String getIdentifier()
          Gets the unique identifier for this user.
 String getOwnerField()
          Gets the owner field value of new objects created by this user.
 Rank getRank()
          Gets the rank of this user.
 int hashCode()
           
 boolean isValid()
          Is valid
 String toString()
          Gets a string representation of this user context (for debugging)
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

authenticationType

protected final String authenticationType

authentication

protected Authentication authentication
Constructor Detail

BasicUser

public BasicUser(Authentication auth,
                 String authenticationType,
                 String identifier)
Method Detail

getIdentifier

public String getIdentifier()
Gets the unique identifier for this user. This should be unique for every different user on the system.

Specified by:
getIdentifier in interface UserContext
Returns:
A unique identifier for this user.

getOwnerField

public String getOwnerField()
Gets the owner field value of new objects created by this user. The default implementation returns the user's identifier. This can be changed if the authorization implementation does not attribute rights to users directly ('context' implementations).

Specified by:
getOwnerField in interface UserContext
Returns:
A possible value for the owner field

getRank

public Rank getRank()
             throws SecurityException
Gets the rank of this user.

Specified by:
getRank in interface UserContext
Returns:
the user rank
Throws:
SecurityException

toString

public String toString()
Gets a string representation of this user context (for debugging)

Overrides:
toString in class Object
Returns:
a string describing the usercontext

isValid

public boolean isValid()
Description copied from interface: UserContext
Is valid

Specified by:
isValid in interface UserContext
Returns:
true if the user is still valid. false if the user is expired..

getAuthenticationType

public String getAuthenticationType()
Description copied from interface: UserContext
Returns the original authentication type as specified in getCloud

Specified by:
getAuthenticationType in interface UserContext
Returns:
authentication type
See Also:
CloudContext.getCloud(java.lang.String)

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable<Object>


MMBase2 Bridge 2.0-SNAPSHOT - 2014-09-22T23:05