|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjp.terasoluna.fw.web.thin.AbstractControlFilter<AuthenticationController>
jp.terasoluna.fw.web.thin.AuthenticationControlFilter
public class AuthenticationControlFilter
Performs logon check.
In this class, the logon check process is transferred to any AuthenticationController
instance which is specified in Bean definition file. This instance performs the filter process of the request received from browser.
When there is a access to the path that requires login,
it is checked whether user has logged in. When the user has not logged in,
UnauthenticatedException
is thrown.
To use this function, perform the following settings
in deployment descriptor (web.xml) and Bean definition file.
In this case, the "ID" attribute which is defined in Bean definition file should be set as sampleAuthenticationController. In the "class" attribute of <bean> element,
set the class that implements the AuthenticationController
interface.
<filter>
<filter-name>
authenticationControlFilter
</filter-name>
<filter-class>
jp.terasoluna.fw.web.thin.AuthenticationControlFilter
</filter-class>
<init-param>
<param-name>controller</param-name>
<param-value>
"sampleAuthenticationController"
</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>authenticationControlFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<error-page>
<exception-type>
jp.terasoluna.fw.web.thin.UnauthenticationException
</exception-type>
<location>/unauthenticatedError.jsp</location>
</error-page>
Bean definition file
<bean id="sampleAuthenticationController"
class="jp.terasoluna...SampleAuthenticationController"/>
At the time of setting the "id" attribute of <bean> element which is defined in Bean definition file
in the "authenticationController" which is the default value, <init-param> element
can be omitted from the <filter> element in deplyment descriptor (web.xml).
AuthenticationController
,
BlockageControlFilter
,
BlockageController
,
ServerBlockageControlFilter
,
ServerBlockageController
Field Summary | |
---|---|
private static java.lang.Class |
AUTHENTICATION_CONTROLLER_CLASS
Controller class that transfers the logon check process. |
private static java.lang.String |
AUTHENTICATION_CONTROLLER_ERROR
Error code indicating the failure in generating the authentication controller. |
static java.lang.String |
AUTHENTICATION_THRU_KEY
Key of "Request" attribute which indicates that the request has passed through the filter. |
protected static AuthenticationController |
controller
AuthenticationController instance. |
static java.lang.String |
DEFAULT_AUTHENTICATION_BEAN_ID
Default id which is used in id attribute of <bean> element to fetch the implementation class of controller from DI container. |
private static org.apache.commons.logging.Log |
log
Log class. |
Fields inherited from class jp.terasoluna.fw.web.thin.AbstractControlFilter |
---|
config |
Constructor Summary | |
---|---|
AuthenticationControlFilter()
|
Method Summary | |
---|---|
void |
doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain)
Performs logon check. |
static AuthenticationController |
getAuthenticationController()
Returns AuthenticationController instance. |
protected java.lang.Class |
getControllerClass()
Returns the interface that should be implemented by the class that performs access control. |
java.lang.String |
getDefaultControllerBeanId()
Returns default id at the time of fetching the controller from DI container. |
protected java.lang.String |
getErrorCode()
Returns error code that indicates failure in generating the controller. |
void |
init(javax.servlet.FilterConfig config)
This method is called by the container when the filter changes to Service start state. After creating an instance of the filter, container calls init method only once. In order to request the Filter to execute the filter process, init method should finish normally. Container cannot change the Filter to service state when the init method is any of the following. ServletException is thrown, It does not get recovered within the time defined by container, The implementation class of the controller does not exist or the settings are abnormal. |
Methods inherited from class jp.terasoluna.fw.web.thin.AbstractControlFilter |
---|
destroy, getController, setConfig |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String AUTHENTICATION_THRU_KEY
public static final java.lang.String DEFAULT_AUTHENTICATION_BEAN_ID
private static final java.lang.String AUTHENTICATION_CONTROLLER_ERROR
private static final java.lang.Class AUTHENTICATION_CONTROLLER_CLASS
private static org.apache.commons.logging.Log log
protected static AuthenticationController controller
Constructor Detail |
---|
public AuthenticationControlFilter()
Method Detail |
---|
public static AuthenticationController getAuthenticationController()
public void init(javax.servlet.FilterConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
init
in class AbstractControlFilter<AuthenticationController>
config
- FilterConfig instance.
javax.servlet.ServletException
- Exception which is thrown at the time of abnormal initialization.Filter.init(javax.servlet.FilterConfig)
,
AbstractControlFilter
public void doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain chain) throws java.io.IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
doFilter
in class AbstractControlFilter<AuthenticationController>
req
- HTTP requestres
- HTTP responsechain
- Filter chain
java.io.IOException
- I/O error
javax.servlet.ServletException
- Servlet exceptionFilter.doFilter(javax.servlet.ServletRequest,
javax.servlet.ServletResponse,
javax.servlet.FilterChain)
protected java.lang.Class getControllerClass()
getControllerClass
in class AbstractControlFilter<AuthenticationController>
protected java.lang.String getErrorCode()
getErrorCode
in class AbstractControlFilter<AuthenticationController>
public java.lang.String getDefaultControllerBeanId()
getDefaultControllerBeanId
in class AbstractControlFilter<AuthenticationController>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |