Search in sources :

Example 1 with ResponseAccountList

use of com.authlete.jaxrs.server.obb.model.ResponseAccountList in project java-oauth-server by authlete.

the class AccountsEndpoint method buildResponseBody.

private static ResponseAccountList buildResponseBody() {
    // Build dummy accounts..
    AccountData account = buildAccount();
    AccountData[] data = new AccountData[] { account };
    Links links = new Links().setSelf("/");
    Meta meta = new Meta(1, 1, ObbUtils.formatNow());
    return new ResponseAccountList(data, links, meta);
}
Also used : Meta(com.authlete.jaxrs.server.obb.model.Meta) ResponseAccountList(com.authlete.jaxrs.server.obb.model.ResponseAccountList) AccountData(com.authlete.jaxrs.server.obb.model.AccountData) Links(com.authlete.jaxrs.server.obb.model.Links)

Example 2 with ResponseAccountList

use of com.authlete.jaxrs.server.obb.model.ResponseAccountList in project java-oauth-server by authlete.

the class AccountsEndpoint 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, "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 3 with ResponseAccountList

use of com.authlete.jaxrs.server.obb.model.ResponseAccountList 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 4 with ResponseAccountList

use of com.authlete.jaxrs.server.obb.model.ResponseAccountList in project java-oauth-server by authlete.

the class FAPI2BaseAccountsEndpoint method buildResponseBody.

private static ResponseAccountList buildResponseBody() {
    // Build dummy accounts..
    AccountData account = buildAccount();
    AccountData[] data = new AccountData[] { account };
    Links links = new Links().setSelf("/");
    Meta meta = new Meta(1, 1, ObbUtils.formatNow());
    return new ResponseAccountList(data, links, meta);
}
Also used : Meta(com.authlete.jaxrs.server.obb.model.Meta) ResponseAccountList(com.authlete.jaxrs.server.obb.model.ResponseAccountList) AccountData(com.authlete.jaxrs.server.obb.model.AccountData) Links(com.authlete.jaxrs.server.obb.model.Links)

Aggregations

ResponseAccountList (com.authlete.jaxrs.server.obb.model.ResponseAccountList)4 AuthleteApi (com.authlete.common.api.AuthleteApi)2 IntrospectionResponse (com.authlete.common.dto.IntrospectionResponse)2 AccountData (com.authlete.jaxrs.server.obb.model.AccountData)2 Links (com.authlete.jaxrs.server.obb.model.Links)2 Meta (com.authlete.jaxrs.server.obb.model.Meta)2 GET (javax.ws.rs.GET)2