org.norther.tammi.spray.authenticator
Interface AuthenticatorFilter

All Superinterfaces:
Filter
All Known Subinterfaces:
CachedAuthFilter, HttpBasicAuthFilter, HttpDigestAuthFilter, HttpFormAuthFilter, HttpSspiAuthFilter, SSLCertAuthFilter, TerminalAuthFilter
All Known Implementing Classes:
AbstractAuthenticatorFilter, DefaultCachedAuthFilter, DefaultHttpBasicAuthFilter, DefaultHttpDigestAuthFilter, DefaultHttpFormAuthFilter, DefaultHttpSspiAuthFilter, DefaultSSLCertAuthFilter, DefaultTerminalAuthFilter

public interface AuthenticatorFilter
extends Filter

An interface to authenticator filters. Implementing classes typically apply different authentication schemes and use an extended interface providing scheme specific methods.

Based on Authenticator in the Apache Jakarta Tomcat project.

Author:
Craig R. McClanahan, Ilkka Priha

Method Summary
 Principal authenticate(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
          Authenticates a request within the realm of this filter.
 String getAuthType()
          Gets the authentication scheme.
 String getDefaultDomain()
          Gets the default domain.
 String getFaultyUser(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
          Gets the faulty user of the specified request.
 int getLoginAttempts()
          Gets the number of allowed login attempts.
 int getLoginAttempts(HttpServletRequest request)
          Gets the number of login attempts of the specified request.
 String getLogoutFlow()
          Gets the logout flow.
 String getLogoutHost()
          Gets the logout host.
 String getLogoutPipe()
          Gets the logout pipe.
 String getLogoutService()
          Gets the logout service.
 String getLogoutTemplate()
          Gets the logout template.
 String getLogoutURI()
          Gets the logout URI.
 StringBuilder getLogoutURL(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
          Gets the logout URL, with the scheme, host and port if required, for the specified request.
 String getPublicRealmName()
          Gets the public name of the realm.
 ObjectName getRealmName()
          Gets the user authentication realm.
 String getUnauthorizedTemplate()
          Gets the unauthorized template.
 boolean isAuthenticationRequired()
          Checks whether authentication is required for unidentified requests.
 boolean isAutoLoginEnabled(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
          Checks whether automatic login is enabled for the specified request.
 boolean isCachedPrincipalDiscarded()
          Checks whether principals authenticated and cached by other authentication objects are discarded and re-authenticated.
 boolean isUserInRole(Principal principal, String role)
          Checks whether the specified principal is in the specified security role within the context of the realm of this filter.
 void setAuthenticationRequired(boolean flag)
          Sets the authentication required flag.
 void setAutoLoginEnabled(HttpServletRequest request, HttpServletResponse response, FilterChain chain, boolean flag)
          Sets whether automatic login is enabled for the specified request.
 void setCachedPrincipalDiscarded(boolean flag)
          Sets whether principals authenticated and cached by other authentication objects are discarded and re-authenticated.
 void setDefaultDomain(String domain)
          Sets the the default domain.
 void setLoginAttempts(int count)
          Sets the number of allowed login attempts.
 void setLogoutFlow(String flow)
          Sets the logout flow.
 void setLogoutHost(String host)
          Sets the logout host.
 void setLogoutPipe(String pipe)
          Sets the logout pipe.
 void setLogoutService(String service)
          Sets the logout service.
 void setLogoutTemplate(String template)
          Sets the logout template.
 void setLogoutURI(String uri)
          Sets the logout URI.
 void setPublicRealmName(String name)
          Sets the public name of the realm.
 void setRealmName(ObjectName realm)
          Sets the user authentication realm.
 void setUnauthorizedTemplate(String template)
          Sets the unauthorized template.
 void unauthenticated(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
          A handler for unauthenticated requests that should provide an opportunity for the user to re-authenticate himself.
 
Methods inherited from interface javax.servlet.Filter
destroy, doFilter, init
 

Method Detail

getAuthType

String getAuthType()
Gets the authentication scheme.

Returns:
the authentication scheme.

getRealmName

ObjectName getRealmName()
Gets the user authentication realm.

Returns:
the name of the realm or a query.

setRealmName

void setRealmName(ObjectName realm)
Sets the user authentication realm.

Parameters:
realm - the name of the realm or a query.

getPublicRealmName

String getPublicRealmName()
Gets the public name of the realm.

Returns:
the public name of the realm.

setPublicRealmName

void setPublicRealmName(String name)
Sets the public name of the realm. The public name is included in generated challenges when required.

Parameters:
name - the public name of the realm.

getDefaultDomain

String getDefaultDomain()
Gets the default domain.

Returns:
the default domain.

setDefaultDomain

void setDefaultDomain(String domain)
Sets the the default domain. The default domain is inserted to usernames separated by a slash if an explicit domain is not already included.

Parameters:
domain - the default domain.

isAuthenticationRequired

boolean isAuthenticationRequired()
Checks whether authentication is required for unidentified requests.

Returns:
true if authentication is required, otherwise false.

setAuthenticationRequired

void setAuthenticationRequired(boolean flag)
Sets the authentication required flag.

Parameters:
flag - the authentication required flag.

isCachedPrincipalDiscarded

boolean isCachedPrincipalDiscarded()
Checks whether principals authenticated and cached by other authentication objects are discarded and re-authenticated.

Returns:
true if cached principals are discarded, otherwise false.

setCachedPrincipalDiscarded

void setCachedPrincipalDiscarded(boolean flag)
Sets whether principals authenticated and cached by other authentication objects are discarded and re-authenticated.

Parameters:
flag - the cached principals discarded flag.

getUnauthorizedTemplate

String getUnauthorizedTemplate()
Gets the unauthorized template.

Returns:
the unauthorized template.

setUnauthorizedTemplate

void setUnauthorizedTemplate(String template)
Sets the unauthorized template.

Parameters:
template - the unauthorized template.

getLoginAttempts

int getLoginAttempts()
Gets the number of allowed login attempts.

Returns:
the number of login attempts, -1 = unlimited.

setLoginAttempts

void setLoginAttempts(int count)
Sets the number of allowed login attempts.

Parameters:
count - the number of login attempts, -1 = unlimited.

getLoginAttempts

int getLoginAttempts(HttpServletRequest request)
Gets the number of login attempts of the specified request.

Parameters:
request - the request.
Returns:
the number of login attempts.

getLogoutURI

String getLogoutURI()
Gets the logout URI.

Returns:
the logout URI.

setLogoutURI

void setLogoutURI(String uri)
Sets the logout URI. An explicit URI overrides the logout host, service, pipe, template and flow.

Parameters:
uri - the logout URI.

getLogoutHost

String getLogoutHost()
Gets the logout host.

Returns:
the logout host.

setLogoutHost

void setLogoutHost(String host)
Sets the logout host.

Parameters:
host - the logout host.

getLogoutService

String getLogoutService()
Gets the logout service.

Returns:
the logout service.

setLogoutService

void setLogoutService(String service)
Sets the logout service. The service is applied to the logout URI if an explicit one is not specified.

Parameters:
service - the logout service.

getLogoutPipe

String getLogoutPipe()
Gets the logout pipe.

Returns:
the logout pipe.

setLogoutPipe

void setLogoutPipe(String pipe)
Sets the logout pipe. The pipe is applied to the logout URI if an explicit one is not specified.

Parameters:
pipe - the logout pipe.

getLogoutFlow

String getLogoutFlow()
Gets the logout flow.

Returns:
the logout flow.

setLogoutFlow

void setLogoutFlow(String flow)
Sets the logout flow. The flow is applied to the logout URI if an explicit one is not specified.

Parameters:
flow - the login flow.

getLogoutTemplate

String getLogoutTemplate()
Gets the logout template.

Returns:
the logout template.

setLogoutTemplate

void setLogoutTemplate(String template)
Sets the logout template. The template is applied to the logout URI if an explicit one is not specified.

Parameters:
template - the logout template.

getLogoutURL

StringBuilder getLogoutURL(HttpServletRequest request,
                           HttpServletResponse response,
                           FilterChain chain)
Gets the logout URL, with the scheme, host and port if required, for the specified request.

Parameters:
request - the request.
response - the response.
chain - the filter chain.
Returns:
the encoded logout URL or null if not defined.

getFaultyUser

String getFaultyUser(HttpServletRequest request,
                     HttpServletResponse response,
                     FilterChain chain)
Gets the faulty user of the specified request. The user is an unauthenticated identity given by the user himself.

Parameters:
request - the request.
response - the response.
chain - the filter chain.
Returns:
the faulty user or null.

authenticate

Principal authenticate(HttpServletRequest request,
                       HttpServletResponse response,
                       FilterChain chain)
Authenticates a request within the realm of this filter.

Parameters:
request - the request.
response - the response.
chain - the filter chain.
Returns:
the authenticated user principal or null.

unauthenticated

void unauthenticated(HttpServletRequest request,
                     HttpServletResponse response,
                     FilterChain chain)
                     throws ServletException,
                            IOException
A handler for unauthenticated requests that should provide an opportunity for the user to re-authenticate himself. Must either produce a valid response or throw an exception.

Parameters:
request - the request.
response - the response.
chain - the filter chain.
Throws:
ServletException - for servlet errors.
IOException - for general errors.

isUserInRole

boolean isUserInRole(Principal principal,
                     String role)
Checks whether the specified principal is in the specified security role within the context of the realm of this filter.

Parameters:
principal - the principal for whom the role is to be checked.
role - the security role to be checked.
Returns:
true or false.

isAutoLoginEnabled

boolean isAutoLoginEnabled(HttpServletRequest request,
                           HttpServletResponse response,
                           FilterChain chain)
Checks whether automatic login is enabled for the specified request.

Parameters:
request - the request.
response - the response.
chain - the filter chain.
Returns:
true if enabled, false otherwise.

setAutoLoginEnabled

void setAutoLoginEnabled(HttpServletRequest request,
                         HttpServletResponse response,
                         FilterChain chain,
                         boolean flag)
Sets whether automatic login is enabled for the specified request.

Parameters:
request - the request.
response - the response.
chain - the filter chain.
flag - true if enabled, false otherwise.


Copyright © 2004 The Norther Organization. All rights reserved.