Search in sources :

Example 6 with IntrospectionResponse

use of com.authlete.common.dto.IntrospectionResponse in project java-oauth-server by authlete.

the class FAPI2BaseAccountsEndpoint method read.

@GET
public Response read(@Context HttpServletRequest request, @HeaderParam(X_FAPI_INTERACTION_ID) String incomingInteractionId) {
    String code = "Accounts 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, "fapi2base-accounts");
    // Make sure that the access token has a "consent:{consentId}" scope.
    ensureConsentScope(outgoingInteractionId, code, info);
    // Build a response body.
    ResponseAccountList body = buildResponseBody();
    // Build a successful response.
    return ObbUtils.ok(outgoingInteractionId, body);
}
Also used : AuthleteApi(com.authlete.common.api.AuthleteApi) ResponseAccountList(com.authlete.jaxrs.server.obb.model.ResponseAccountList) IntrospectionResponse(com.authlete.common.dto.IntrospectionResponse) GET(javax.ws.rs.GET)

Example 7 with IntrospectionResponse

use of com.authlete.common.dto.IntrospectionResponse 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);
}
Also used : AuthleteApi(com.authlete.common.api.AuthleteApi) IntrospectionResponse(com.authlete.common.dto.IntrospectionResponse) ResponseResourceList(com.authlete.jaxrs.server.obb.model.ResponseResourceList) GET(javax.ws.rs.GET)

Aggregations

IntrospectionResponse (com.authlete.common.dto.IntrospectionResponse)7 AuthleteApi (com.authlete.common.api.AuthleteApi)6 GET (javax.ws.rs.GET)4 Consent (com.authlete.jaxrs.server.obb.model.Consent)3 CreateConsent (com.authlete.jaxrs.server.obb.model.CreateConsent)3 ResponseConsent (com.authlete.jaxrs.server.obb.model.ResponseConsent)3 ResponseAccountList (com.authlete.jaxrs.server.obb.model.ResponseAccountList)2 Path (javax.ws.rs.Path)2 AuthleteApiException (com.authlete.common.api.AuthleteApiException)1 Action (com.authlete.common.dto.IntrospectionResponse.Action)1 ResponseResourceList (com.authlete.jaxrs.server.obb.model.ResponseResourceList)1 Consumes (javax.ws.rs.Consumes)1 DELETE (javax.ws.rs.DELETE)1 POST (javax.ws.rs.POST)1