org.springframework.security.oauth.provider.filter
Class CoreOAuthProviderSupport

java.lang.Object
  extended by org.springframework.security.oauth.provider.filter.CoreOAuthProviderSupport
All Implemented Interfaces:
OAuthProviderSupport

public class CoreOAuthProviderSupport
extends Object
implements OAuthProviderSupport

Utility for common logic for supporting an OAuth provider.

Author:
Ryan Heaton

Constructor Summary
CoreOAuthProviderSupport()
           
 
Method Summary
 String getBaseUrl()
          The configured base URL for this OAuth provider.
protected  String getBaseUrl(HttpServletRequest request)
          The configured base URL for this OAuth provider for the given HttpServletRequest.
 String getSignatureBaseString(HttpServletRequest request)
          Get the signature base string for the specified request, per OAuth Core 1.0, 9.1
protected  Set<String> getSupportedOAuthParameters()
          Get the supported OAuth parameters.
protected  SortedMap<String,SortedSet<String>> loadSignificantParametersForSignatureBaseString(HttpServletRequest request)
          Loads the significant parameters (name-to-value map) that are to be used to calculate the signature base string.
protected  String normalizeUrl(String url)
          Normalize the URL for use in the signature.
protected  Map<String,String> parseHeaderParameters(HttpServletRequest request)
          Parse the OAuth header parameters.
 Map<String,String> parseParameters(HttpServletRequest request)
          Parse the oauth consumer paramters from an HttpServletRequest.
 void setBaseUrl(String baseUrl)
          The configured base URL for the OAuth provider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoreOAuthProviderSupport

public CoreOAuthProviderSupport()
Method Detail

parseParameters

public Map<String,String> parseParameters(HttpServletRequest request)
Description copied from interface: OAuthProviderSupport
Parse the oauth consumer paramters from an HttpServletRequest. The parameters are to be decoded per the OAuth spec.

Specified by:
parseParameters in interface OAuthProviderSupport
Parameters:
request - The servlet request.
Returns:
The parsed parameters.

parseHeaderParameters

protected Map<String,String> parseHeaderParameters(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.

getSupportedOAuthParameters

protected Set<String> getSupportedOAuthParameters()
Get the supported OAuth parameters. The default implementation supports only the OAuth core parameters.

Returns:
The OAuth core parameters.

getSignatureBaseString

public String getSignatureBaseString(HttpServletRequest request)
Description copied from interface: OAuthProviderSupport
Get the signature base string for the specified request, per OAuth Core 1.0, 9.1

Specified by:
getSignatureBaseString in interface OAuthProviderSupport
Parameters:
request - The request.
Returns:
The signature base string.

normalizeUrl

protected String normalizeUrl(String url)
Normalize the URL for use in the signature. The OAuth spec says the URL protocol and host are to be lower-case, and the query and fragments are to be stripped.

Parameters:
url - The URL.
Returns:
The URL normalized for use in the signature.

loadSignificantParametersForSignatureBaseString

protected SortedMap<String,SortedSet<String>> loadSignificantParametersForSignatureBaseString(HttpServletRequest request)
Loads the significant parameters (name-to-value map) that are to be used to calculate the signature base string. The parameters will be encoded, per the spec section 9.1.

Parameters:
request - The request.
Returns:
The significan parameters.

getBaseUrl

protected String getBaseUrl(HttpServletRequest request)
The configured base URL for this OAuth provider for the given HttpServletRequest. Default implementation return getBaseUrl() + request URI.

Parameters:
request - The HttpServletRequest currently processed
Returns:
The configured base URL for this OAuth provider with respect to the supplied HttpServletRequest.

getBaseUrl

public String getBaseUrl()
The configured base URL for this OAuth provider.

Returns:
The configured base URL for this OAuth provider.

setBaseUrl

public void setBaseUrl(String baseUrl)
The configured base URL for the OAuth provider.

Parameters:
baseUrl - The configured base URL for the OAuth provider.


Copyright © 2012. All Rights Reserved.