Search in sources :

Example 1 with CancelRequest

use of com.okta.idx.sdk.api.request.CancelRequest in project okta-idx-java by okta.

the class BaseIDXClient method cancel.

@Override
public IDXResponse cancel(String stateHandle) throws ProcessingException {
    IDXResponse idxResponse;
    CancelRequest cancelRequest = CancelRequestBuilder.builder().withStateHandle(stateHandle).build();
    try {
        Request request = new DefaultRequest(HttpMethod.POST, clientConfiguration.getBaseUrl() + "/idp/idx/cancel", null, getHttpHeaders(false), new ByteArrayInputStream(objectMapper.writeValueAsBytes(cancelRequest)), -1L);
        Response response = requestExecutor.executeRequest(request);
        if (response.getHttpStatus() != 200) {
            handleErrorResponse(request, response);
        }
        JsonNode responseJsonNode = objectMapper.readTree(response.getBody());
        idxResponse = objectMapper.convertValue(responseJsonNode, IDXResponse.class);
    } catch (IOException | HttpException e) {
        throw new ProcessingException(e);
    }
    return idxResponse;
}
Also used : ErrorResponse(com.okta.idx.sdk.api.response.ErrorResponse) IDXResponse(com.okta.idx.sdk.api.response.IDXResponse) InteractResponse(com.okta.idx.sdk.api.response.InteractResponse) Response(com.okta.commons.http.Response) TokenResponse(com.okta.idx.sdk.api.response.TokenResponse) DefaultRequest(com.okta.commons.http.DefaultRequest) ByteArrayInputStream(java.io.ByteArrayInputStream) SkipAuthenticatorEnrollmentRequest(com.okta.idx.sdk.api.request.SkipAuthenticatorEnrollmentRequest) Request(com.okta.commons.http.Request) IdentifyRequest(com.okta.idx.sdk.api.request.IdentifyRequest) EnrollUserProfileUpdateRequest(com.okta.idx.sdk.api.request.EnrollUserProfileUpdateRequest) DefaultRequest(com.okta.commons.http.DefaultRequest) EnrollRequest(com.okta.idx.sdk.api.request.EnrollRequest) ChallengeRequest(com.okta.idx.sdk.api.request.ChallengeRequest) CancelRequest(com.okta.idx.sdk.api.request.CancelRequest) RecoverRequest(com.okta.idx.sdk.api.request.RecoverRequest) IntrospectRequest(com.okta.idx.sdk.api.request.IntrospectRequest) AnswerChallengeRequest(com.okta.idx.sdk.api.request.AnswerChallengeRequest) PollRequest(com.okta.idx.sdk.api.request.PollRequest) CancelRequest(com.okta.idx.sdk.api.request.CancelRequest) JsonNode(com.fasterxml.jackson.databind.JsonNode) HttpException(com.okta.commons.http.HttpException) IOException(java.io.IOException) IDXResponse(com.okta.idx.sdk.api.response.IDXResponse) ProcessingException(com.okta.idx.sdk.api.exception.ProcessingException)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)1 DefaultRequest (com.okta.commons.http.DefaultRequest)1 HttpException (com.okta.commons.http.HttpException)1 Request (com.okta.commons.http.Request)1 Response (com.okta.commons.http.Response)1 ProcessingException (com.okta.idx.sdk.api.exception.ProcessingException)1 AnswerChallengeRequest (com.okta.idx.sdk.api.request.AnswerChallengeRequest)1 CancelRequest (com.okta.idx.sdk.api.request.CancelRequest)1 ChallengeRequest (com.okta.idx.sdk.api.request.ChallengeRequest)1 EnrollRequest (com.okta.idx.sdk.api.request.EnrollRequest)1 EnrollUserProfileUpdateRequest (com.okta.idx.sdk.api.request.EnrollUserProfileUpdateRequest)1 IdentifyRequest (com.okta.idx.sdk.api.request.IdentifyRequest)1 IntrospectRequest (com.okta.idx.sdk.api.request.IntrospectRequest)1 PollRequest (com.okta.idx.sdk.api.request.PollRequest)1 RecoverRequest (com.okta.idx.sdk.api.request.RecoverRequest)1 SkipAuthenticatorEnrollmentRequest (com.okta.idx.sdk.api.request.SkipAuthenticatorEnrollmentRequest)1 ErrorResponse (com.okta.idx.sdk.api.response.ErrorResponse)1 IDXResponse (com.okta.idx.sdk.api.response.IDXResponse)1 InteractResponse (com.okta.idx.sdk.api.response.InteractResponse)1 TokenResponse (com.okta.idx.sdk.api.response.TokenResponse)1