|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectse.kmr.scam.client.http.filter.SecurityContextFilter
Filter that assures that servlets will execute in the security context of
the user that sent the request. This is achieved by doing a (temporary) JAAS
login and is based on the assumption that a proper JAAS login module is
configured; i.e. one that initializes the implementation dependent security
context. For JBoss, this is the ClientLoginModule
.
The JAAS application name (i.e. name of JAAS configuration that must be used)
can be set using the filter init parameter jaas-application
.
For JBoss, this is the name of the application-policy configured in the
login-config.xml; it should be something like
<application-policy name = "client-login"> <authentication> <login-module code = "org.jboss.security.ClientLoginModule" flag = "required"> </login-module> </authentication> </application-policy>This implementation assumes that the user is stored in a UserBean.
Nested Class Summary | |
class |
SecurityContextFilter.UsernamePasswordHandler
Simple JAAS callback handler that can handle NameCallback and PasswordCallback. |
Field Summary | |
protected SecurityContextFilter.UsernamePasswordHandler |
callbackHandler
the jaas callbackhandler |
static String |
JAAS_APPL_DEFAULT
|
static String |
JAAS_APPL_PARAM_NAME
|
protected String |
jaasApplicationName
The name of the JAAS application, the key for finding the JAAS module configuration (e.g. in an auth.conf file). |
protected LoginContext |
loginCtx
the login context used for the login and logout operations |
Constructor Summary | |
SecurityContextFilter()
|
Method Summary | |
void |
destroy()
Destroys the filter. |
void |
doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
Performs a temporary JAAS login for the duration of the request. |
void |
init(FilterConfig config)
Initializes the filter. |
protected void |
jaasLogin(String username,
String password)
Performs a JAAS login based on the JAAS configuration set in the init method. |
protected void |
jaasLogout()
Performs a JAAS logout. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String JAAS_APPL_DEFAULT
public static final String JAAS_APPL_PARAM_NAME
protected String jaasApplicationName
protected LoginContext loginCtx
protected SecurityContextFilter.UsernamePasswordHandler callbackHandler
Constructor Detail |
public SecurityContextFilter()
Method Detail |
public void init(FilterConfig config)
init
in interface Filter
config
- the filter configuration objectpublic void destroy()
destroy
in interface Filter
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
doFilter
in interface Filter
request
- the (http) requestresponse
- the (http) responsechain
- the filter chain
IOException
ServletException
protected void jaasLogin(String username, String password)
protected void jaasLogout()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |