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);
}
}
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);
}
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);
}
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);
}
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);
}
Aggregations