nl.surfnet.coin.api
Class AbstractApiController

java.lang.Object
  extended by nl.surfnet.coin.api.AbstractApiController
Direct Known Subclasses:
ApiController

public abstract class AbstractApiController
extends Object


Constructor Summary
AbstractApiController()
           
 
Method Summary
protected  ClientMetaData getClientMetaData()
           
protected  String getOnBehalfOf()
          Get the username of the (via oauth) authenticated user that performs this request.
 org.springframework.http.ResponseEntity<String> preflightCORS(String origin, String[] methods, String[] headers)
          Handle CORS preflight request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractApiController

public AbstractApiController()
Method Detail

getOnBehalfOf

protected String getOnBehalfOf()
Get the username of the (via oauth) authenticated user that performs this request.

Returns:
the username in case of an end user authorized request (3 legged oauth1, authorization code grant oauth2) or the consumer key in case of unauthorized requests.

getClientMetaData

protected ClientMetaData getClientMetaData()

preflightCORS

@RequestMapping(method=OPTIONS,
                value="/**")
public org.springframework.http.ResponseEntity<String> preflightCORS(@RequestHeader(value="Origin")
                                                                                    String origin,
                                                                                    @RequestHeader(value="Access-Control-Request-Method",required=false)
                                                                                    String[] methods,
                                                                                    @RequestHeader(value="Access-Control-Request-Headers",required=false)
                                                                                    String[] headers)
Handle CORS preflight request.

Parameters:
origin - the Origin header
methods - the "Access-Control-Request-Method" header
headers - the "Access-Control-Request-Headers" header
Returns:
a ResponseEntity with 204 (no content) and the right response headers


Copyright © 2009-2012 SURFnet bv, The Netherlands. All Rights Reserved.