org.objectweb.jonas.security.realm.web.jetty50
Class Standard

java.lang.Object
  extended by org.objectweb.jonas.security.realm.web.jetty50.Standard
All Implemented Interfaces:
org.mortbay.http.UserRealm
Direct Known Subclasses:
JAAS

public class Standard
extends java.lang.Object
implements org.mortbay.http.UserRealm

Implementation of a Realm. Use any JOnAS realm by specifying the resource name

Author:
Greg Wilkins for the HashUserRealm, Florent Benoit : Jetty 4.2.x / JOnAS 3.1

Constructor Summary
protected Standard()
          Default Constructor
  Standard(java.lang.String resourceName)
          Constructor
  Standard(java.lang.String name, java.lang.String resourceName)
          Constructor
 
Method Summary
protected  void addUser(java.lang.String username, java.security.Principal principal)
          Add a user to the current map
 java.security.Principal authenticate(java.lang.String username, java.lang.Object credentials, org.mortbay.http.HttpRequest request)
          Authenticate a user with a specific username and credentials
 void disassociate(java.security.Principal user)
          Disassociate a user Not implemented
protected static org.objectweb.util.monolog.api.Logger getLogger()
           
 java.lang.String getName()
           
 java.security.Principal getPrincipal(java.lang.String username)
          Gets the principal with the given username
protected  java.util.Map getUsers()
           
 boolean isAuthenticated(java.security.Principal user)
          Check if a user is authenticated
 boolean isUserInRole(java.security.Principal user, java.lang.String roleName)
          Check if a user is in a role.
 void logout(java.security.Principal user)
          Log out a specific user
 java.security.Principal popRole(java.security.Principal user)
          Pop a role to a user Not implemented
 java.security.Principal pushRole(java.security.Principal user, java.lang.String role)
          Push a role to a user Not implemented
 boolean reauthenticate(java.security.Principal user)
          Check if the specific user is authenticated
protected  void removeUser(java.lang.String username)
          Remove a specific user
protected  void setName(java.lang.String name)
          Sets the name of the realm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Standard

protected Standard()
Default Constructor


Standard

public Standard(java.lang.String resourceName)
         throws java.lang.Exception
Constructor

Parameters:
resourceName - name of the resource to use
Throws:
java.lang.Exception - if the resource can't be retrieved

Standard

public Standard(java.lang.String name,
                java.lang.String resourceName)
         throws java.lang.Exception
Constructor

Parameters:
name - name of the realm
resourceName - name of the resource to use
Throws:
java.lang.Exception - if the resource can't be retrieved
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface org.mortbay.http.UserRealm
Returns:
The realm name.

authenticate

public java.security.Principal authenticate(java.lang.String username,
                                            java.lang.Object credentials,
                                            org.mortbay.http.HttpRequest request)
Authenticate a user with a specific username and credentials

Specified by:
authenticate in interface org.mortbay.http.UserRealm
Parameters:
username - name of the user
credentials - credential of the user
request - httprequest
Returns:
a Jetty principal

isUserInRole

public boolean isUserInRole(java.security.Principal user,
                            java.lang.String roleName)
Check if a user is in a role.

Specified by:
isUserInRole in interface org.mortbay.http.UserRealm
Parameters:
user - The user, which must be from this realm
roleName - the role to test for the given user
Returns:
True if the user can act in the role.

isAuthenticated

public boolean isAuthenticated(java.security.Principal user)
Check if a user is authenticated

Parameters:
user - The user, which must be from this realm
Returns:
True if the user is authenticated

getPrincipal

public java.security.Principal getPrincipal(java.lang.String username)
Gets the principal with the given username

Specified by:
getPrincipal in interface org.mortbay.http.UserRealm
Parameters:
username - the given username
Returns:
the principal with the given username

disassociate

public void disassociate(java.security.Principal user)
Disassociate a user Not implemented

Specified by:
disassociate in interface org.mortbay.http.UserRealm
Parameters:
user - the given user

pushRole

public java.security.Principal pushRole(java.security.Principal user,
                                        java.lang.String role)
Push a role to a user Not implemented

Specified by:
pushRole in interface org.mortbay.http.UserRealm
Parameters:
user - the given user
role - the role to push
Returns:
the new principal

popRole

public java.security.Principal popRole(java.security.Principal user)
Pop a role to a user Not implemented

Specified by:
popRole in interface org.mortbay.http.UserRealm
Parameters:
user - the given user
Returns:
the new principal

logout

public void logout(java.security.Principal user)
Log out a specific user

Specified by:
logout in interface org.mortbay.http.UserRealm
Parameters:
user - the user to logout

reauthenticate

public boolean reauthenticate(java.security.Principal user)
Check if the specific user is authenticated

Specified by:
reauthenticate in interface org.mortbay.http.UserRealm
Parameters:
user - the user to reauthenticate
Returns:
true if the user is authenthicated

getLogger

protected static org.objectweb.util.monolog.api.Logger getLogger()
Returns:
the logger.

getUsers

protected java.util.Map getUsers()
Returns:
the users.

removeUser

protected void removeUser(java.lang.String username)
Remove a specific user

Parameters:
username - user to remove

addUser

protected void addUser(java.lang.String username,
                       java.security.Principal principal)
Add a user to the current map

Parameters:
username - name of the user
principal - object

setName

protected void setName(java.lang.String name)
Sets the name of the realm

Parameters:
name - The name to set.