## org.mortbay.jaas
Class JAASUserRealm

    java.lang.Object
      |
      +--org.mortbay.jaas.JAASUserRealm

All Implemented Interfaces:
  UserRealm

public class JAASUserRealm
extends java.lang.Object
implements UserRealm

JAASUserRealm

#### Notes

#### Usage

###

###

###

###

###

###

###

###

###

###

###

###

    Constructor Summary

    JAASUserRealm()

              Constructor.

    JAASUserRealm(java.lang.String name)

              Constructor.

    Method Summary

     UserPrincipal
    authenticate(java.lang.String username,
                 java.lang.Object credentials,
                 HttpRequest request)

              Authenticate a user.

     void
    disassociate(UserPrincipal user)

              Removes any auth info associated with eg.

     java.lang.String
    getName()

              Get the name of the realm.

     void
    logout(UserPrincipal user)

              Logout a previously logged in user.

     UserPrincipal
    popRole(UserPrincipal user)

              Remove a role temporarily granted to a user.

     UserPrincipal
    pushRole(UserPrincipal user,
             java.lang.String role)

              Temporarily adds a role to a user.

     void
    setCallbackHandler(AbstractCallbackHandler handler)

              Set up a specifc CallbackHandler.

     void
    setLoginModuleName(java.lang.String name)

              Set the name to use to index into the config
     file of LoginModules.

     void
    setName(java.lang.String name)

              Set the name of the realm

     void
    setRoleCheckPolicy(RoleCheckPolicy policy)

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Constructor Detail

    JAASUserRealm

    public JAASUserRealm()

    Constructor.

    JAASUserRealm

    public JAASUserRealm(java.lang.String name)

    Constructor.

    Parameters:name - the name of the realm

    Method Detail

    getName

    public java.lang.String getName()

    Get the name of the realm.

    Specified by:getName in interface UserRealm

    Returns:name or null if not set.

    setName

    public void setName(java.lang.String name)

    Set the name of the realm

    Parameters:name - a String value

    setLoginModuleName

    public void setLoginModuleName(java.lang.String name)

    Set the name to use to index into the config
     file of LoginModules.

    Parameters:name - a String value

    setCallbackHandler

    public void setCallbackHandler(AbstractCallbackHandler handler)

    Set up a specifc CallbackHandler.
     If not called, then the DefaultCallbackHandler is used.

    Parameters:handler - an AbstractCallbackHandler value

    setRoleCheckPolicy

    public void setRoleCheckPolicy(RoleCheckPolicy policy)

    authenticate

    public UserPrincipal authenticate(java.lang.String username,
                                      java.lang.Object credentials,
                                      HttpRequest request)

    Authenticate a user.

    Specified by:authenticate in interface UserRealm

    Parameters:username - provided by the user at logincredentials - provided by the user at loginrequest - a HttpRequest value
    Returns:authenticated JAASUserPrincipal or  null if authenticated failed

    disassociate

    public void disassociate(UserPrincipal user)

    Removes any auth info associated with eg. the thread.

    Specified by:disassociate in interface UserRealm

    Parameters:user - a UserPrincipal to disassociate

    pushRole

    public UserPrincipal pushRole(UserPrincipal user,
                                  java.lang.String role)

    Temporarily adds a role to a user.

     Temporarily granting a role pushes the role onto a stack
     of temporary roles. Temporary roles must therefore be
     removed in order.

    Specified by:pushRole in interface UserRealm

    Parameters:user - the UserPrincipal to which to add the rolerole - the role name
    Returns:the UserPrincipal with the role added

    popRole

    public UserPrincipal popRole(UserPrincipal user)

    Remove a role temporarily granted to a user.

    Specified by:popRole in interface UserRealm

    Parameters:user - the UserPrincipal from whom to remove the role
    Returns:the UserPrincipal

    logout

    public void logout(UserPrincipal user)

    Logout a previously logged in user.
     This can only work for FORM authentication
     as BasicAuthentication is stateless.

     The user's LoginContext logout() method is called.

    Specified by:logout in interface UserRealm

    Parameters:user - an UserPrincipal value

    Copyright © 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.