use of com.authlete.common.api.AuthleteApi in project java-oauth-server by authlete.
the class ResourcesEndpoint method read.
@GET
public Response read(@Context HttpServletRequest request, @HeaderParam(X_FAPI_INTERACTION_ID) String incomingInteractionId) {
String code = "Resources Read";
// Compute a value for the "x-fapi-interaction-id" HTTP response header.
String outgoingInteractionId = ObbUtils.computeOutgoingInteractionId(code, incomingInteractionId);
// Validate the access token.
AuthleteApi authleteApi = AuthleteApiFactory.getDefaultApi();
IntrospectionResponse info = ObbUtils.validateAccessToken(outgoingInteractionId, code, authleteApi, request, "resources");
// Make sure that the access token has a "consent:{consentId}" scope.
ensureConsentScope(outgoingInteractionId, code, info);
// Build a response body.
ResponseResourceList body = buildResponseBody();
// Build a successful response.
return ObbUtils.ok(outgoingInteractionId, body);
}
use of com.authlete.common.api.AuthleteApi in project java-oauth-server by authlete.
the class TokenEndpoint method post.
/**
* The token endpoint for {@code POST} method.
*
* <p>
* <a href="http://tools.ietf.org/html/rfc6749#section-3.2">RFC 6749,
* 3.2. Token Endpoint</a> says:
* </p>
*
* <blockquote>
* <i>The client MUST use the HTTP "POST" method when making access
* token requests.</i>
* </blockquote>
*
* <p>
* <a href="http://tools.ietf.org/html/rfc6749#section-2.3">RFC 6749,
* 2.3. Client Authentication</a> mentions (1) HTTP Basic Authentication
* and (2) {@code client_id} & {@code client_secret} parameters in
* the request body as the means of client authentication. This
* implementation supports the both means.
* </p>
*
* @see <a href="http://tools.ietf.org/html/rfc6749#section-3.2"
* >RFC 6749, 3.2. Token Endpoint</a>
*/
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response post(@Context HttpServletRequest request, MultivaluedMap<String, String> parameters) {
// Authlete API
AuthleteApi authleteApi = AuthleteApiFactory.getDefaultApi();
// Process the token request in a standard way.
Response response = processTokenRequest(authleteApi, request, parameters);
// Do additional tasks as necessary.
doTasks(authleteApi, request, parameters, response);
return response;
}
Aggregations