org.ow2.jonas.web.jetty6.security
Class Realm

java.lang.Object
  extended by org.ow2.jonas.web.jetty6.security.Realm
All Implemented Interfaces:
org.mortbay.jetty.security.UserRealm

public class Realm
extends Object
implements org.mortbay.jetty.security.UserRealm

Realm used by Jetty 6 service.

Author:
Florent Benoit

Constructor Summary
Realm()
          Default Constructor.
Realm(String name)
          Default Constructor.
 
Method Summary
protected  void addUser(String username, JettyPrincipal principal)
          Add a user to the current map.
 Principal authenticate(String username, Object credentials, org.mortbay.jetty.Request request)
          Authenticate a user with a specific username and credentials.
 void disassociate(Principal user)
          Disassociate a user.
 String getName()
           
 Principal getPrincipal(String username)
          Gets the principal with the given username.
protected  Map<String,JettyPrincipal> getUsers()
           
 boolean isUserInRole(Principal user, String roleName)
          Check if a user is in a role.
 void logout(Principal user)
          Log out a specific user.
 Principal popRole(Principal user)
          Pop a role to a user (not implemented).
 Principal pushRole(Principal user, String role)
          Push a role to a user (not implemented).
 boolean reauthenticate(Principal user)
          Check if the specific user is authenticated.
protected  void removeUser(String username)
          Remove a specific user.
protected  void setName(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

Realm

public Realm()
Default Constructor.


Realm

public Realm(String name)
Default Constructor.

Parameters:
name - of the realm
Method Detail

authenticate

public Principal authenticate(String username,
                              Object credentials,
                              org.mortbay.jetty.Request request)
Authenticate a user with a specific username and credentials.

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

getUsers

protected Map<String,JettyPrincipal> getUsers()
Returns:
the users.

addUser

protected void addUser(String username,
                       JettyPrincipal principal)
Add a user to the current map.

Parameters:
username - name of the user
principal - object

removeUser

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

Parameters:
username - user to remove

isUserInRole

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

Specified by:
isUserInRole in interface org.mortbay.jetty.security.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.

getPrincipal

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

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

disassociate

public void disassociate(Principal user)
Disassociate a user.

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

pushRole

public Principal pushRole(Principal user,
                          String role)
Push a role to a user (not implemented).

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

popRole

public Principal popRole(Principal user)
Pop a role to a user (not implemented).

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

logout

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

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

reauthenticate

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

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

setName

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

Parameters:
name - The name to set.

getName

public String getName()
Specified by:
getName in interface org.mortbay.jetty.security.UserRealm
Returns:
The realm name.


Copyright © 2010 OW2 Consortium. All Rights Reserved.