org.springframework.security.oauth2.provider.endpoint
Class TokenEndpoint

java.lang.Object
  extended by org.springframework.security.oauth2.provider.endpoint.AbstractEndpoint
      extended by org.springframework.security.oauth2.provider.endpoint.TokenEndpoint
All Implemented Interfaces:
InitializingBean

@RequestMapping(value="/oauth/token")
public class TokenEndpoint
extends AbstractEndpoint

Endpoint for token requests as described in the OAuth2 spec. Clients post requests with a grant_type parameter (e.g. "authorization_code") and other parameters as determined by the grant type. Supported grant types are handled by the provided token granter.

Clients must be authenticated using a Spring Security Authentication to access this endpoint, and the client id is extracted from the authentication token. The best way to arrange this (as per the OAuth2 spec) is to use HTTP basic authentication for this endpoint with standard Spring Security support.

Author:
Dave Syer

Field Summary
 
Fields inherited from class org.springframework.security.oauth2.provider.endpoint.AbstractEndpoint
logger
 
Constructor Summary
TokenEndpoint()
           
 
Method Summary
 org.springframework.http.ResponseEntity<OAuth2AccessToken> getAccessToken(Principal principal, String grantType, Map<String,String> parameters)
           
 org.springframework.http.ResponseEntity<OAuth2Exception> handleException(Exception e)
           
 org.springframework.http.ResponseEntity<OAuth2Exception> handleNoSuchClientException(Exception e)
           
 
Methods inherited from class org.springframework.security.oauth2.provider.endpoint.AbstractEndpoint
afterPropertiesSet, getAuthorizationRequestManager, getClientDetailsService, getDefaultAuthorizationRequestManager, getExceptionTranslator, getTokenGranter, setAuthorizationRequestManager, setClientDetailsService, setProviderExceptionHandler, setTokenGranter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenEndpoint

public TokenEndpoint()
Method Detail

getAccessToken

@RequestMapping
public org.springframework.http.ResponseEntity<OAuth2AccessToken> getAccessToken(Principal principal,
                                                                                                @RequestParam(value="grant_type")
                                                                                                String grantType,
                                                                                                @RequestParam
                                                                                                Map<String,String> parameters)

handleNoSuchClientException

@ExceptionHandler(value=NoSuchClientException.class)
public org.springframework.http.ResponseEntity<OAuth2Exception> handleNoSuchClientException(Exception e)
                                                                                     throws Exception
Throws:
Exception

handleException

@ExceptionHandler(value=OAuth2Exception.class)
public org.springframework.http.ResponseEntity<OAuth2Exception> handleException(Exception e)
                                                                         throws Exception
Throws:
Exception


Copyright © 2012. All Rights Reserved.