use of com.okta.idx.sdk.api.request.EnrollUserProfileUpdateRequest in project okta-idx-java by okta.
the class IDXAuthenticationWrapper method register.
/**
* Register new user with the supplied user profile reference.
*
* @param proceedContext the ProceedContext
* @param userProfile the user profile
* @return the Authentication response
*/
public AuthenticationResponse register(ProceedContext proceedContext, UserProfile userProfile) {
try {
AuthenticationTransaction enrollTransaction = AuthenticationTransaction.proceed(client, proceedContext, () -> {
EnrollUserProfileUpdateRequest enrollUserProfileUpdateRequest = EnrollUserProfileUpdateRequestBuilder.builder().withUserProfile(userProfile).withStateHandle(proceedContext.getStateHandle()).build();
return client.enrollUpdateUserProfile(enrollUserProfileUpdateRequest, proceedContext.getHref());
});
// Verify the next remediation is correct.
enrollTransaction.getRemediationOption(RemediationType.SELECT_AUTHENTICATOR_ENROLL);
return enrollTransaction.asAuthenticationResponse(AuthenticationStatus.AWAITING_AUTHENTICATOR_SELECTION);
} catch (ProcessingException e) {
return handleProcessingException(e);
} catch (IllegalArgumentException e) {
return handleIllegalArgumentException(e);
}
}
use of com.okta.idx.sdk.api.request.EnrollUserProfileUpdateRequest in project okta-idx-java by okta.
the class BaseIDXClient method enrollUpdateUserProfile.
@Override
public IDXResponse enrollUpdateUserProfile(EnrollUserProfileUpdateRequest enrollUserProfileUpdateRequest, String href) throws ProcessingException {
IDXResponse idxResponse;
try {
Request request = new DefaultRequest(HttpMethod.POST, href, null, getHttpHeaders(false), new ByteArrayInputStream(objectMapper.writeValueAsBytes(enrollUserProfileUpdateRequest)), -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;
}
Aggregations