org.norther.tammi.spray.authenticator.tool
Class UserTool

java.lang.Object
  extended by org.norther.tammi.core.pool.RecyclableSupport
      extended by org.norther.tammi.core.pool.PoolableSupport
          extended by org.norther.tammi.spray.engine.tool.GlobalTool
              extended by org.norther.tammi.spray.engine.tool.ContextTool
                  extended by org.norther.tammi.spray.authenticator.tool.UserTool
All Implemented Interfaces:
Serializable, Cloneable, EventListener, Poolable, Recyclable, ContextBindingListener

public class UserTool
extends ContextTool

A request context tool for user info.

Version:
$Id: UserTool.java,v 1.24 2010-05-11 04:40:27 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
UserTool()
          Constructs a new info.
 
Method Summary
 boolean checkAuthenticated()
          Checks whether the user is authenticated and not logged out.
 void dispose()
          Disposes the object by setting its disposed flag.
protected  AuthenticatorFilter getAuthenticatorFilter()
          Gets the authenticator filter from the filter stack.
 String getAuthType()
          Gets the name of the authentication scheme used to protect the current pipe, for example, "BASIC" or "SSL" or null if the pipe was not protected.
 String getForgetOption()
          Gets the forget option.
protected  HttpFilter getHttpFilter()
          Gets the protocol filter from the filter stack.
 String getIdentity()
          Gets the crypted identity of the user.
 String getLoginAction()
          Gets the login action.
 int getLoginAge()
          Gets the login age.
 int getLoginAttempts()
          Gets the number of login attempts made.
 String getLoginCheck()
          Gets the login check.
 String getLoginURL()
          Gets the login URL.
 String getLogoutAction()
          Gets the logout action.
 String getLogoutURL()
          Gets the logout URL.
 String getPasswordField()
          Gets the password field.
 String getRealName()
          Gets the real name of the user.
 String getRememberOption()
          Gets the remember option.
 String getRemoteUser()
          Gets the username of the remote user.
 String getUsernameField()
          Gets the username field.
 boolean isAnonymous()
          Checks whether the user is anonymous.
 boolean isAuthenticated()
          Checks whether the user is authenticated.
 boolean isAuthenticationRequired()
          Checks whether authentication is required.
 boolean isAutoLoginEnabled()
          Checks whether automatic login is enabled.
 boolean isUserInRole(String role)
          Checks whether the authenticated user is included in the specified logical "role".
 void logout()
          Logs out a user by invalidating the current session.
 void setAutoLoginEnabled(boolean flag)
          Sets whether automatic login is enabled.
 
Methods inherited from class org.norther.tammi.spray.engine.tool.ContextTool
getFilter, getFilterChain, getFilterKey, getPrincipal, getRequest, getResponse, isFilterChanged
 
Methods inherited from class org.norther.tammi.spray.engine.tool.GlobalTool
clone, getContext, getContextToolFilter, getMBeanServer, isBound, nop, toString, valueBound, valueUnbound
 
Methods inherited from class org.norther.tammi.core.pool.PoolableSupport
disposed, recycled
 
Methods inherited from class org.norther.tammi.core.pool.RecyclableSupport
isDisposed, recycle
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.core.pool.Recyclable
isDisposed, recycle
 

Constructor Detail

UserTool

public UserTool()
Constructs a new info.

Method Detail

dispose

public void dispose()
Description copied from class: RecyclableSupport
Disposes the object by setting its disposed flag.

Specified by:
dispose in interface Recyclable
Overrides:
dispose in class ContextTool

getLoginCheck

public String getLoginCheck()
Gets the login check.

Returns:
the login check.

getLoginAction

public String getLoginAction()
Gets the login action.

Returns:
the login action.

getLogoutAction

public String getLogoutAction()
Gets the logout action.

Returns:
the logout action.

getUsernameField

public String getUsernameField()
Gets the username field.

Returns:
the username field.

getPasswordField

public String getPasswordField()
Gets the password field.

Returns:
the password field.

getRememberOption

public String getRememberOption()
Gets the remember option.

Returns:
the remember option.

getForgetOption

public String getForgetOption()
Gets the forget option.

Returns:
the forget option.

isAuthenticationRequired

public boolean isAuthenticationRequired()
Checks whether authentication is required.

Returns:
true if authentication is required.

getLoginAttempts

public int getLoginAttempts()
Gets the number of login attempts made.

Returns:
the number of login attempts.

getRemoteUser

public String getRemoteUser()
Gets the username of the remote user. The name can be either an authenticated one or a faulty identity given by the user himself.

Returns:
the username of the user or null.

getRealName

public String getRealName()
Gets the real name of the user. If not specified, the username is returned.

Returns:
the real name of the user or null.

getIdentity

public String getIdentity()
Gets the crypted identity of the user.

Returns:
the identity of the user or null.

isAuthenticated

public boolean isAuthenticated()
Checks whether the user is authenticated.

Returns:
true if the user is authenticated.

checkAuthenticated

public boolean checkAuthenticated()
Checks whether the user is authenticated and not logged out.

Returns:
true if the user is authenticated.

isAnonymous

public boolean isAnonymous()
Checks whether the user is anonymous.

Returns:
true if the user is anonymous.

getAuthType

public String getAuthType()
Gets the name of the authentication scheme used to protect the current pipe, for example, "BASIC" or "SSL" or null if the pipe was not protected.

Returns:
the authentication type or null.

isUserInRole

public boolean isUserInRole(String role)
Checks whether the authenticated user is included in the specified logical "role".

Parameters:
role - the role to check.
Returns:
true or false.

getLoginAge

public int getLoginAge()
Gets the login age.

Returns:
the login age in seconds.

getLoginURL

public String getLoginURL()
Gets the login URL.

Returns:
the login URL.

getLogoutURL

public String getLogoutURL()
Gets the logout URL.

Returns:
the logout URL.

isAutoLoginEnabled

public boolean isAutoLoginEnabled()
Checks whether automatic login is enabled.

Returns:
true or false.

setAutoLoginEnabled

public void setAutoLoginEnabled(boolean flag)
Sets whether automatic login is enabled.

Parameters:
flag - true or false.

logout

public void logout()
Logs out a user by invalidating the current session.


getHttpFilter

protected HttpFilter getHttpFilter()
Gets the protocol filter from the filter stack.

Returns:
the protocol filter or null.

getAuthenticatorFilter

protected AuthenticatorFilter getAuthenticatorFilter()
Gets the authenticator filter from the filter stack.

Returns:
the authenticator filter or null.


Copyright © 2004 The Norther Organization. All rights reserved.