use of com.authlete.jaxrs.BackchannelAuthenticationCompleteRequestHandler in project java-oauth-server by authlete.
the class BackchannelAuthenticationCallbackEndpoint method doProcess.
private Response doProcess(AsyncAuthenticationCallbackRequest request) {
// Get the result of end-user authentication and authorization.
Result result = getResult(request);
// Get the ID of the request that this authorization server made to the
// authentication device in AsyncAuthenticationDeviceProcessor.
String requestId = getRequestId(request);
// Retrieve information that was stored in AsyncAuthenticationDeviceProcessor.
AuthInfo authInfo = getAuthInfo(requestId);
// Get some variables from the stored information.
String ticket = authInfo.getTicket();
User user = authInfo.getUser();
String[] claimNames = authInfo.getClaimNames();
String[] acrs = authInfo.getAcrs();
Date authTime = (result == Result.AUTHORIZED) ? new Date() : null;
String errorDescription = determineErrorDescription(request);
// Complete the authentication and authorization process.
new BackchannelAuthenticationCompleteRequestHandler(AuthleteApiFactory.getDefaultApi(), new BackchannelAuthenticationCompleteHandlerSpiImpl(result, user, authTime, acrs, errorDescription, null)).handle(ticket, claimNames);
// Delete the stored information.
removeAuthInfo(requestId);
// 204 No Content.
return noContent();
}
Aggregations