Search in sources :

Example 1 with AuthleteApi

use of com.authlete.common.api.AuthleteApi in project authlete-java-common by authlete.

the class CLI method execute.

private void execute(String[] args) {
    // Parse the command line arguments.
    Settings settings = parseArguments(args);
    // Validate the settings.
    validateSettings(settings);
    // Load "authlete.properties" and create an AuthleteApi instance.
    AuthleteApi api = AuthleteApiFactory.getDefaultApi();
    try {
        // Execute the specified API.
        executeApi(api, settings);
    } catch (AuthleteApiException e) {
        // Report the error.
        reportError(e);
    }
}
Also used : AuthleteApi(com.authlete.common.api.AuthleteApi) AuthleteApiException(com.authlete.common.api.AuthleteApiException)

Example 2 with AuthleteApi

use of com.authlete.common.api.AuthleteApi in project java-oauth-server by authlete.

the class ClientRegistrationEndpoint method update.

/**
 * Dynamic client registration management endpoint, "update" functionality.
 */
@PUT
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
public Response update(@HeaderParam(HttpHeaders.AUTHORIZATION) String authorization, @PathParam("id") String clientId, String json, @Context HttpServletRequest httpServletRequest) {
    // The interface of Authlete APIs.
    AuthleteApi api = AuthleteApiFactory.getDefaultApi();
    // Pre-process the request body as necessary.
    json = preprocessRequestBody(httpServletRequest, json);
    // Execute the "update" operation.
    return handleUpdate(api, clientId, json, authorization);
}
Also used : AuthleteApi(com.authlete.common.api.AuthleteApi) Path(javax.ws.rs.Path) Consumes(javax.ws.rs.Consumes) PUT(javax.ws.rs.PUT)

Example 3 with AuthleteApi

use of com.authlete.common.api.AuthleteApi in project java-oauth-server by authlete.

the class ClientRegistrationEndpoint method register.

/**
 * Dynamic client registration endpoint.
 */
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response register(@HeaderParam(HttpHeaders.AUTHORIZATION) String authorization, String json, @Context HttpServletRequest httpServletRequest) {
    // The interface of Authlete APIs.
    AuthleteApi api = AuthleteApiFactory.getDefaultApi();
    // Pre-process the request body as necessary.
    json = preprocessRequestBody(httpServletRequest, json);
    // Execute the "register" operation.
    return handleRegister(api, json, authorization);
}
Also used : AuthleteApi(com.authlete.common.api.AuthleteApi) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes)

Example 4 with AuthleteApi

use of com.authlete.common.api.AuthleteApi in project java-oauth-server by authlete.

the class ConsentsEndpoint method delete.

@DELETE
@Path("{consentId}")
public Response delete(@Context HttpServletRequest request, @HeaderParam(X_FAPI_INTERACTION_ID) String incomingInteractionId, @PathParam("consentId") String consentId) {
    String code = "Consent Delete";
    // 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, "consents");
    // Find "consent".
    Consent consent = ConsentDao.getInstance().read(consentId);
    // Validate the consent.
    validateConsent(outgoingInteractionId, code, consent, info);
    // Delete the refresh token associated with the consent.
    deleteRefreshToken(outgoingInteractionId, code, authleteApi, consent.getRefreshToken());
    // Delete the consent.
    ConsentDao.getInstance().delete(consentId);
    // Build a successful response.
    return ObbUtils.noContent(outgoingInteractionId);
}
Also used : AuthleteApi(com.authlete.common.api.AuthleteApi) IntrospectionResponse(com.authlete.common.dto.IntrospectionResponse) CreateConsent(com.authlete.jaxrs.server.obb.model.CreateConsent) ResponseConsent(com.authlete.jaxrs.server.obb.model.ResponseConsent) Consent(com.authlete.jaxrs.server.obb.model.Consent) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE)

Example 5 with AuthleteApi

use of com.authlete.common.api.AuthleteApi in project java-oauth-server by authlete.

the class ClientRegistrationEndpoint method delete.

/**
 * Dynamic client registration management endpoint, "delete" functionality.
 */
@DELETE
@Path("/{id}")
public Response delete(@HeaderParam(HttpHeaders.AUTHORIZATION) String authorization, @PathParam("id") String clientId, @Context HttpServletRequest httpServletRequest) {
    // The interface of Authlete APIs.
    AuthleteApi api = AuthleteApiFactory.getDefaultApi();
    // Extra process before executing the "delete" operation.
    preprocessClient(httpServletRequest, api, clientId);
    // Execute the "delete" operation.
    return handleDelete(api, clientId, authorization);
}
Also used : AuthleteApi(com.authlete.common.api.AuthleteApi) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE)

Aggregations

AuthleteApi (com.authlete.common.api.AuthleteApi)12 IntrospectionResponse (com.authlete.common.dto.IntrospectionResponse)6 GET (javax.ws.rs.GET)5 Path (javax.ws.rs.Path)5 Consumes (javax.ws.rs.Consumes)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 POST (javax.ws.rs.POST)3 ResponseAccountList (com.authlete.jaxrs.server.obb.model.ResponseAccountList)2 DELETE (javax.ws.rs.DELETE)2 AuthleteApiException (com.authlete.common.api.AuthleteApiException)1 ResponseResourceList (com.authlete.jaxrs.server.obb.model.ResponseResourceList)1 PUT (javax.ws.rs.PUT)1 Response (javax.ws.rs.core.Response)1