public class OAuthConsumerContextFilter extends Object implements javax.servlet.Filter, InitializingBean, MessageSourceAware
Modifier and Type | Field and Description |
---|---|
static String |
ACCESS_TOKENS_DEFAULT_ATTRIBUTE |
protected MessageSourceAccessor |
messages |
static String |
OAUTH_FAILURE_KEY |
Constructor and Description |
---|
OAuthConsumerContextFilter() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected ProtectedResourceDetails |
checkForResourceThatNeedsAuthorization(Exception ex)
Check the given exception for the resource that needs authorization.
|
void |
destroy() |
void |
doFilter(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse,
javax.servlet.FilterChain chain) |
protected void |
fail(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
OAuthRequestFailedException failure)
Common logic for OAuth failed.
|
String |
getAccessTokensRequestAttribute()
The default request attribute into which the OAuth access tokens are stored.
|
protected String |
getCallbackURL(javax.servlet.http.HttpServletRequest request)
Get the callback URL for the specified request.
|
OAuthConsumerSupport |
getConsumerSupport()
The OAuth consumer support.
|
org.springframework.security.web.access.AccessDeniedHandler |
getOAuthFailureHandler()
The oauth failure handler.
|
org.springframework.security.web.PortResolver |
getPortResolver()
The port resolver.
|
org.springframework.security.web.RedirectStrategy |
getRedirectStrategy()
The redirect strategy.
|
OAuthRememberMeServices |
getRememberMeServices()
The remember-me services.
|
org.springframework.security.web.util.ThrowableAnalyzer |
getThrowableAnalyzer()
The throwable analyzer.
|
OAuthConsumerTokenServices |
getTokenServices()
The token services.
|
protected String |
getUserAuthorizationRedirectURL(ProtectedResourceDetails details,
OAuthConsumerToken requestToken,
String callbackURL)
Get the URL to which to redirect the user for authorization of protected resources.
|
void |
init(javax.servlet.FilterConfig ignored) |
void |
setAccessTokensRequestAttribute(String accessTokensRequestAttribute)
The default request attribute into which the OAuth access tokens are stored.
|
void |
setConsumerSupport(OAuthConsumerSupport consumerSupport)
The OAuth consumer support.
|
void |
setMessageSource(MessageSource messageSource)
Set the message source.
|
void |
setOAuthFailureHandler(org.springframework.security.web.access.AccessDeniedHandler OAuthFailureHandler)
The oauth failure handler.
|
void |
setPortResolver(org.springframework.security.web.PortResolver portResolver)
The port resolver.
|
void |
setRedirectStrategy(org.springframework.security.web.RedirectStrategy redirectStrategy)
The redirect strategy.
|
void |
setRememberMeServices(OAuthRememberMeServices rememberMeServices)
The remember-me services.
|
void |
setThrowableAnalyzer(org.springframework.security.web.util.ThrowableAnalyzer throwableAnalyzer)
The throwable analyzer.
|
void |
setTokenServices(OAuthConsumerTokenServices tokenServices)
The token services.
|
public static final String ACCESS_TOKENS_DEFAULT_ATTRIBUTE
public static final String OAUTH_FAILURE_KEY
protected MessageSourceAccessor messages
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public void init(javax.servlet.FilterConfig ignored) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
public void destroy()
destroy
in interface javax.servlet.Filter
public void doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
IOException
javax.servlet.ServletException
protected ProtectedResourceDetails checkForResourceThatNeedsAuthorization(Exception ex) throws javax.servlet.ServletException, IOException
ex
- The exception.javax.servlet.ServletException
- in the case of an underlying Servlet API exceptionIOException
- in the case of general IO exceptionsprotected String getCallbackURL(javax.servlet.http.HttpServletRequest request)
request
- The request.protected String getUserAuthorizationRedirectURL(ProtectedResourceDetails details, OAuthConsumerToken requestToken, String callbackURL)
details
- The resource for which to get the authorization url.requestToken
- The request token.callbackURL
- The callback URL.protected void fail(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, OAuthRequestFailedException failure) throws IOException, javax.servlet.ServletException
request
- The request.response
- The response.failure
- The failure.javax.servlet.ServletException
- in the case of an underlying Servlet API exceptionIOException
- in the case of general IO exceptionspublic org.springframework.security.web.access.AccessDeniedHandler getOAuthFailureHandler()
public void setOAuthFailureHandler(org.springframework.security.web.access.AccessDeniedHandler OAuthFailureHandler)
OAuthFailureHandler
- The oauth failure handler.public OAuthConsumerTokenServices getTokenServices()
public void setTokenServices(OAuthConsumerTokenServices tokenServices)
tokenServices
- The token services.public void setMessageSource(MessageSource messageSource)
setMessageSource
in interface MessageSourceAware
messageSource
- The message source.public OAuthConsumerSupport getConsumerSupport()
public void setConsumerSupport(OAuthConsumerSupport consumerSupport)
consumerSupport
- The OAuth consumer support.public String getAccessTokensRequestAttribute()
public void setAccessTokensRequestAttribute(String accessTokensRequestAttribute)
accessTokensRequestAttribute
- The default request attribute into which the OAuth access tokens are stored.public org.springframework.security.web.PortResolver getPortResolver()
public void setPortResolver(org.springframework.security.web.PortResolver portResolver)
portResolver
- The port resolver.public OAuthRememberMeServices getRememberMeServices()
public void setRememberMeServices(OAuthRememberMeServices rememberMeServices)
rememberMeServices
- The remember-me services.public org.springframework.security.web.util.ThrowableAnalyzer getThrowableAnalyzer()
public void setThrowableAnalyzer(org.springframework.security.web.util.ThrowableAnalyzer throwableAnalyzer)
throwableAnalyzer
- The throwable analyzer.public org.springframework.security.web.RedirectStrategy getRedirectStrategy()
public void setRedirectStrategy(org.springframework.security.web.RedirectStrategy redirectStrategy)
redirectStrategy
- The redirect strategy.Copyright © 2019. All rights reserved.