org.objectweb.jonas.security.realm
Class JRealmJetty42

java.lang.Object
  extended byorg.objectweb.jonas.security.realm.JRealmJetty42

public class JRealmJetty42
extends java.lang.Object

Implementation of a Realm. Use any JOnAS realm by specifying the resource name 12/03 Update to take into account new Realm mechanism of Jetty

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

Constructor Summary
JRealmJetty42(java.lang.String resourceName)
          Constructor
JRealmJetty42(java.lang.String name, java.lang.String resourceName)
          Constructor
 
Method Summary
 UserPrincipal authenticate(java.lang.String username, java.lang.Object credentials, HttpRequest request)
          Authenticate a user with a specific username and credentials
 void disassociate(UserPrincipal user)
          Disassociate a user Not implemented
 java.lang.String getName()
           
 java.security.Principal getPrincipal(java.lang.String username)
          Gets the principal with the given username
 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(UserPrincipal user)
          Log out a specific user
 UserPrincipal popRole(UserPrincipal user)
          Pop a role to a user Not implemented
 UserPrincipal pushRole(UserPrincipal 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JRealmJetty42

public JRealmJetty42(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

JRealmJetty42

public JRealmJetty42(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()
Returns:
The realm name.

authenticate

public UserPrincipal authenticate(java.lang.String username,
                                  java.lang.Object credentials,
                                  HttpRequest request)
Authenticate a user with a specific username and credentials

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.

Parameters:
user - The user, which must be from this realm
roleName -
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

Parameters:
username - the given username
Returns:
the principal with the given username

disassociate

public void disassociate(UserPrincipal user)
Disassociate a user Not implemented

Parameters:
user - the given user

pushRole

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

Parameters:
user - the given user
role - the role to push
Returns:
the new principal

popRole

public UserPrincipal popRole(UserPrincipal user)
Pop a role to a user Not implemented

Parameters:
user - the given user
Returns:
the new principal

logout

public void logout(UserPrincipal user)
Log out a specific user

Parameters:
user - the user to logout

reauthenticate

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

Parameters:
user - the user to reauthenticate
Returns:
true if the user is authenthicated