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.

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
UserTool()
          Constructs a new info.
 
Method Summary
 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 curent pipe, for example, "BASIC" or "SSL" or null if the pipe was not protected.
 int getLoginAge()
          Gets the login age.
 int getLoginAttempts()
          Gets the number of login attempts made.
 String getLoginURL()
          Gets the login URL.
 String getLogoutURL()
          Gets the logout URL.
 String getRealName()
          Gets the real name of the user.
 String getRemoteUser()
          Gets the username of the remote user.
 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, getName, 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

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.

isAuthenticated

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

Returns:
true if the user is authenticated.

getAuthType

public String getAuthType()
Gets the name of the authentication scheme used to protect the curent 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.


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.