org.springframework.security.oauth2.client.filter
Class OAuth2ClientContextFilter

java.lang.Object
  extended by org.springframework.security.oauth2.client.filter.OAuth2ClientContextFilter
All Implemented Interfaces:
javax.servlet.Filter, org.springframework.beans.factory.InitializingBean

public class OAuth2ClientContextFilter
extends Object
implements javax.servlet.Filter, org.springframework.beans.factory.InitializingBean

Security filter for an OAuth2 client.

Author:
Ryan Heaton, Dave Syer

Field Summary
static String CURRENT_URI
          Key in request attributes for the current URI in case it is needed by rest client code that needs to send a redirect URI to an authorization server.
 
Constructor Summary
OAuth2ClientContextFilter()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  String calculateCurrentUri(javax.servlet.http.HttpServletRequest request)
          Calculate the current URI given the request.
 void destroy()
           
 void doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain chain)
           
 void init(javax.servlet.FilterConfig filterConfig)
           
protected  void redirectUser(UserRedirectRequiredException e, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Redirect the user according to the specified exception.
 void setRedirectStrategy(org.springframework.security.web.RedirectStrategy redirectStrategy)
           
 void setThrowableAnalyzer(org.springframework.security.web.util.ThrowableAnalyzer throwableAnalyzer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENT_URI

public static final String CURRENT_URI
Key in request attributes for the current URI in case it is needed by rest client code that needs to send a redirect URI to an authorization server.

See Also:
Constant Field Values
Constructor Detail

OAuth2ClientContextFilter

public OAuth2ClientContextFilter()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

doFilter

public void doFilter(javax.servlet.ServletRequest servletRequest,
                     javax.servlet.ServletResponse servletResponse,
                     javax.servlet.FilterChain chain)
              throws IOException,
                     javax.servlet.ServletException
Specified by:
doFilter in interface javax.servlet.Filter
Throws:
IOException
javax.servlet.ServletException

redirectUser

protected void redirectUser(UserRedirectRequiredException e,
                            javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
                     throws IOException
Redirect the user according to the specified exception.

Parameters:
resourceThatNeedsAuthorization -
e - The user redirect exception.
request - The request.
response - The response.
Throws:
IOException

calculateCurrentUri

protected String calculateCurrentUri(javax.servlet.http.HttpServletRequest request)
                              throws UnsupportedEncodingException
Calculate the current URI given the request.

Parameters:
request - The request.
Returns:
The current uri.
Throws:
UnsupportedEncodingException

init

public void init(javax.servlet.FilterConfig filterConfig)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Filter
Throws:
javax.servlet.ServletException

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Filter

setThrowableAnalyzer

public void setThrowableAnalyzer(org.springframework.security.web.util.ThrowableAnalyzer throwableAnalyzer)

setRedirectStrategy

public void setRedirectStrategy(org.springframework.security.web.RedirectStrategy redirectStrategy)


Copyright © 2013. All rights reserved.