org.springframework.security.oauth.provider
Class UserAuthorizationProcessingFilter

java.lang.Object
  extended by org.springframework.security.ui.SpringSecurityFilter
      extended by org.springframework.security.ui.AbstractProcessingFilter
          extended by org.springframework.security.oauth.provider.UserAuthorizationProcessingFilter
All Implemented Interfaces:
javax.servlet.Filter, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.MessageSourceAware, org.springframework.core.Ordered

public class UserAuthorizationProcessingFilter
extends org.springframework.security.ui.AbstractProcessingFilter

Processing filter for handling a request to authenticate an OAuth request token. The default processes URL is "/oauth_authenticate_token"

This filter looks for two request parameters, one for the token id and one for the callback URL. The default names of these paramaters are "oauth_token" and "oauth_callback", but this can be configured.

Upon successful authorization of the request token, the response is a redirect back to the callback, if supplied. Otherwise, the response is a redirect to the default target URL. Upon failure to authorize, the response is a redirect to failure URL.

Author:
Ryan Heaton

Field Summary
static int FILTER_CHAIN_ORDER
           
 
Fields inherited from class org.springframework.security.ui.AbstractProcessingFilter
authenticationDetailsSource, eventPublisher, messages, SPRING_SECURITY_LAST_EXCEPTION_KEY, SPRING_SECURITY_SAVED_REQUEST_KEY
 
Fields inherited from class org.springframework.security.ui.SpringSecurityFilter
logger
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
UserAuthorizationProcessingFilter()
           
 
Method Summary
 void afterPropertiesSet()
           
 org.springframework.security.Authentication attemptAuthentication(javax.servlet.http.HttpServletRequest request)
           
protected  java.lang.String determineTargetUrl(javax.servlet.http.HttpServletRequest request)
           
 java.lang.String getCallbackParameterName()
          The name of the request parameter that supplies the callback URL.
 java.lang.String getDefaultFilterProcessesUrl()
           
 int getOrder()
          User authorization comes after the request token.
 java.lang.String getTokenParameterName()
          The name of the request parameter that supplies the token id.
 OAuthProviderTokenServices getTokenServices()
          Get the OAuth token services.
protected  void onPreAuthentication(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void setCallbackParameterName(java.lang.String callbackParameterName)
          The name of the request parameter that supplies the callback URL.
 void setTokenIdParameterName(java.lang.String tokenIdParameterName)
          The name of the request parameter that supplies the token id.
 void setTokenServices(OAuthProviderTokenServices tokenServices)
          The OAuth token services.
 
Methods inherited from class org.springframework.security.ui.AbstractProcessingFilter
determineFailureUrl, doFilterHttp, getAllowSessionCreation, getAuthenticationDetailsSource, getAuthenticationFailureUrl, getAuthenticationManager, getDefaultTargetUrl, getFilterProcessesUrl, getRememberMeServices, getTargetUrlResolver, obtainFullSavedRequestUrl, onSuccessfulAuthentication, onUnsuccessfulAuthentication, requiresAuthentication, sendRedirect, setAllowSessionCreation, setAlwaysUseDefaultTargetUrl, setApplicationEventPublisher, setAuthenticationDetailsSource, setAuthenticationFailureUrl, setAuthenticationManager, setContinueChainBeforeSuccessfulAuthentication, setDefaultTargetUrl, setExceptionMappings, setFilterProcessesUrl, setInvalidateSessionOnSuccessfulAuthentication, setMessageSource, setMigrateInvalidatedSessionAttributes, setRememberMeServices, setServerSideRedirect, setTargetUrlResolver, setUseRelativeContext, successfulAuthentication, unsuccessfulAuthentication
 
Methods inherited from class org.springframework.security.ui.SpringSecurityFilter
destroy, doFilter, init, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FILTER_CHAIN_ORDER

public static final int FILTER_CHAIN_ORDER
Constructor Detail

UserAuthorizationProcessingFilter

public UserAuthorizationProcessingFilter()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Overrides:
afterPropertiesSet in class org.springframework.security.ui.AbstractProcessingFilter
Throws:
java.lang.Exception

onPreAuthentication

protected void onPreAuthentication(javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response)
                            throws org.springframework.security.AuthenticationException,
                                   java.io.IOException
Overrides:
onPreAuthentication in class org.springframework.security.ui.AbstractProcessingFilter
Throws:
org.springframework.security.AuthenticationException
java.io.IOException

attemptAuthentication

public org.springframework.security.Authentication attemptAuthentication(javax.servlet.http.HttpServletRequest request)
                                                                  throws org.springframework.security.AuthenticationException
Specified by:
attemptAuthentication in class org.springframework.security.ui.AbstractProcessingFilter
Throws:
org.springframework.security.AuthenticationException

determineTargetUrl

protected java.lang.String determineTargetUrl(javax.servlet.http.HttpServletRequest request)
Overrides:
determineTargetUrl in class org.springframework.security.ui.AbstractProcessingFilter

getDefaultFilterProcessesUrl

public java.lang.String getDefaultFilterProcessesUrl()
Specified by:
getDefaultFilterProcessesUrl in class org.springframework.security.ui.AbstractProcessingFilter

getOrder

public int getOrder()
User authorization comes after the request token.

Returns:
The order after the request token.

getTokenParameterName

public java.lang.String getTokenParameterName()
The name of the request parameter that supplies the token id.

Returns:
The name of the request parameter that supplies the token id.

setTokenIdParameterName

public void setTokenIdParameterName(java.lang.String tokenIdParameterName)
The name of the request parameter that supplies the token id.

Parameters:
tokenIdParameterName - The name of the request parameter that supplies the token id.

getCallbackParameterName

public java.lang.String getCallbackParameterName()
The name of the request parameter that supplies the callback URL.

Returns:
The name of the request parameter that supplies the callback URL.

setCallbackParameterName

public void setCallbackParameterName(java.lang.String callbackParameterName)
The name of the request parameter that supplies the callback URL.

Parameters:
callbackParameterName - The name of the request parameter that supplies the callback URL.

getTokenServices

public OAuthProviderTokenServices getTokenServices()
Get the OAuth token services.

Returns:
The OAuth token services.

setTokenServices

public void setTokenServices(OAuthProviderTokenServices tokenServices)
The OAuth token services.

Parameters:
tokenServices - The OAuth token services.


Copyright © 2008. All Rights Reserved.