public final class OAuthFilter
extends java.lang.Object
implements javax.servlet.Filter
SSOClientFilter in
order to allow the application to accept requests with a valid OAuth token.
These tokens are created and authorised via websignon with your provider ID.
If the user has provided an Authorization header in the HTTP request that
corresponds to a valid OAuth token, and there is no authorised user already
in the request, an User will be inserted into the request the
key specified by SSOClientFilter.getUserKey() and will be accessible
for the remainder of the request. This should allow the filter to be dropped
in immediately after the SSOClientFilter and work immediately.
Users from this filter will return true for User.isOAuthUser().
OAuth details are as follows:
| Constructor and Description |
|---|
OAuthFilter() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
void |
doFilter(javax.servlet.ServletRequest arg0,
javax.servlet.ServletResponse arg1,
javax.servlet.FilterChain chain) |
uk.ac.warwick.sso.client.SSOConfiguration |
getConfig() |
java.lang.String |
getConfigSuffix() |
uk.ac.warwick.sso.client.oauth.OAuthService |
getOAuthService() |
uk.ac.warwick.userlookup.UserLookupInterface |
getUserLookup() |
void |
init(javax.servlet.FilterConfig ctx) |
void |
setConfig(uk.ac.warwick.sso.client.SSOConfiguration config) |
void |
setConfigSuffix(java.lang.String configSuffix)
Set the configuration suffix for the sso-config.xml file.
|
void |
setExpiredToken401(boolean expiredToken401)
If set to true (the default), then any Authorization header in the
request that does not resolve to a valid OAuth token will cause the
application to generate a HTTP 401 Unauthorized, instructing the user to
use OAuth.
|
void |
setOAuthService(uk.ac.warwick.sso.client.oauth.OAuthService service) |
void |
setUserLookup(uk.ac.warwick.userlookup.UserLookupInterface userLookup) |
public void doFilter(javax.servlet.ServletRequest arg0,
javax.servlet.ServletResponse arg1,
javax.servlet.FilterChain chain)
throws java.io.IOException,
javax.servlet.ServletException
doFilter in interface javax.servlet.Filterjava.io.IOExceptionjavax.servlet.ServletExceptionpublic void init(javax.servlet.FilterConfig ctx)
throws javax.servlet.ServletException
init in interface javax.servlet.Filterjavax.servlet.ServletExceptionpublic void destroy()
destroy in interface javax.servlet.Filterpublic uk.ac.warwick.sso.client.SSOConfiguration getConfig()
public void setConfig(uk.ac.warwick.sso.client.SSOConfiguration config)
public java.lang.String getConfigSuffix()
public void setConfigSuffix(java.lang.String configSuffix)
SSOClientFilterconfigSuffix - The configuration suffix stringpublic uk.ac.warwick.sso.client.oauth.OAuthService getOAuthService()
public void setOAuthService(uk.ac.warwick.sso.client.oauth.OAuthService service)
public uk.ac.warwick.userlookup.UserLookupInterface getUserLookup()
public void setUserLookup(uk.ac.warwick.userlookup.UserLookupInterface userLookup)
public void setExpiredToken401(boolean expiredToken401)