org.springframework.security.oauth2.provider.authentication
Class OAuth2AuthenticationProcessingFilter

java.lang.Object
  extended by org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter
All Implemented Interfaces:
Filter, InitializingBean

public class OAuth2AuthenticationProcessingFilter
extends Object
implements Filter, InitializingBean

A pre-authemtication filter for OAuth2 protected resources. Extracts an OAuth2 token from the in coming request and uses it to populate the Spring Security context with an OAuth2Authentication (if used in conjunction with an OAuth2AuthenticationManager).

Author:
Dave Syer

Constructor Summary
OAuth2AuthenticationProcessingFilter()
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
           
 void init(FilterConfig filterConfig)
           
protected  String parseHeaderToken(HttpServletRequest request)
          Parse the OAuth header parameters.
protected  String parseToken(HttpServletRequest request)
           
 void setAuthenticationDetailsSource(org.springframework.security.authentication.AuthenticationDetailsSource<HttpServletRequest,?> authenticationDetailsSource)
           
 void setAuthenticationEntryPoint(org.springframework.security.web.AuthenticationEntryPoint authenticationEntryPoint)
           
 void setAuthenticationManager(org.springframework.security.authentication.AuthenticationManager authenticationManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OAuth2AuthenticationProcessingFilter

public OAuth2AuthenticationProcessingFilter()
Method Detail

setAuthenticationEntryPoint

public void setAuthenticationEntryPoint(org.springframework.security.web.AuthenticationEntryPoint authenticationEntryPoint)
Parameters:
authenticationEntryPoint - the authentication entry point to set

setAuthenticationManager

public void setAuthenticationManager(org.springframework.security.authentication.AuthenticationManager authenticationManager)
Parameters:
authenticationManager - the authentication manager to set (mandatory with no default)

setAuthenticationDetailsSource

public void setAuthenticationDetailsSource(org.springframework.security.authentication.AuthenticationDetailsSource<HttpServletRequest,?> authenticationDetailsSource)
Parameters:
authenticationDetailsSource - The AuthenticationDetailsSource to use

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface InitializingBean

doFilter

public void doFilter(ServletRequest req,
                     ServletResponse res,
                     FilterChain chain)
              throws IOException,
                     ServletException
Specified by:
doFilter in interface Filter
Throws:
IOException
ServletException

parseToken

protected String parseToken(HttpServletRequest request)

parseHeaderToken

protected String parseHeaderToken(HttpServletRequest request)
Parse the OAuth header parameters. The parameters will be oauth-decoded.

Parameters:
request - The request.
Returns:
The parsed parameters, or null if no OAuth authorization header was supplied.

init

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

destroy

public void destroy()
Specified by:
destroy in interface Filter


Copyright © 2012. All Rights Reserved.