org.objectweb.security.jetty.realm
Class JonasRealm

org.objectweb.security.jetty.realm.JonasRealm

public class JonasRealm

Jetty realm which propagates the security context to Jonas container. It also delegates all functionality to any desired Jetty realm to perform the true authentication. This will ensure that we can integrate any existing Jetty realm with Jonas just through XML configuration.

Author:
Miroslav Halas

Field Summary
protected  org.objectweb.security.jetty.realm.UserRealm m_urRealm
          This is the real Jetty realm this realm will delegate to.
 
Constructor Summary
JonasRealm(org.objectweb.security.jetty.realm.UserRealm urRealm)
          Creates a new instance of JonasRealm
 
Method Summary
 org.objectweb.security.jetty.realm.UserPrincipal authenticate(java.lang.String strUsername, java.lang.String strCredentials, org.objectweb.security.jetty.realm.HttpRequest httpRequest)
          Authenticate a users credentials.
 void dissassociate(org.objectweb.security.jetty.realm.UserPrincipal userPrincipal)
          Dissassociate the calling context with a Principal.
 java.lang.String getName()
          ???
 org.objectweb.security.jetty.realm.UserPrincipal popRole(org.objectweb.security.jetty.realm.UserPrincipal userPrincipal)
          Pop role from a Principal.
 org.objectweb.security.jetty.realm.UserPrincipal pushRole(org.objectweb.security.jetty.realm.UserPrincipal userPrincipal, java.lang.String strRole)
          Push role onto a Principal.
 

Field Detail

m_urRealm

protected org.objectweb.security.jetty.realm.UserRealm m_urRealm
This is the real Jetty realm this realm will delegate to.
Constructor Detail

JonasRealm

public JonasRealm(org.objectweb.security.jetty.realm.UserRealm urRealm)
Creates a new instance of JonasRealm
Parameters:
urRealm - - the real Jetty realm this realm will delegate to
Method Detail

authenticate

public org.objectweb.security.jetty.realm.UserPrincipal authenticate(java.lang.String strUsername,
                                                                     java.lang.String strCredentials,
                                                                     org.objectweb.security.jetty.realm.HttpRequest httpRequest)
Authenticate a users credentials. Implementations of this method may adorn the calling context to assoicate it with the authenticated principal (eg ThreadLocals). If such context associations are made, they should be considered valid until a UserRealm.deAuthenticate(UserPrincipal) call is made for this UserPrincipal.
Parameters:
strUsername - - The username
strCredentials - - The user credentials, normally a password.
strRequest - - The request to be authenticated. Additional parameters may be extracted or set on this request as needed for the authentication mechanism (none required for BASIC and FORM authentication).
Returns:
UserPrincipal - The authenticated UserPrincipal.

dissassociate

public void dissassociate(org.objectweb.security.jetty.realm.UserPrincipal userPrincipal)
Dissassociate the calling context with a Principal. This method is called when the calling context is not longer associated with the Principal. It should be used by an implementation to remove context associations such as ThreadLocals. The UserPrincipal object remains authenticated, as it may be associated with other contexts.
Parameters:
userPrincipal - - A UserPrincipal allocated from this realm.

getName

public java.lang.String getName()
???
Returns:
String

popRole

public org.objectweb.security.jetty.realm.UserPrincipal popRole(org.objectweb.security.jetty.realm.UserPrincipal userPrincipal)
Pop role from a Principal.
Parameters:
userPrincipal - - A UserPrincipal previously returned from pushRole
Returns:
UserPrincipal - The principal without the role. Most often this will be the original UserPrincipal passed.

pushRole

public org.objectweb.security.jetty.realm.UserPrincipal pushRole(org.objectweb.security.jetty.realm.UserPrincipal userPrincipal,
                                                                 java.lang.String strRole)
Push role onto a Principal. This method is used to add a role to an existing principal.
Parameters:
userPrincipal - - An existing UserPrincipal or null for an anonymous user.
strRole - - The role to add.
Returns:
A new UserPrincipal object that wraps the passed user, but with the added role.