Search in sources :

Example 1 with Result

use of com.authlete.common.dto.BackchannelAuthenticationCompleteRequest.Result 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();
}
Also used : User(com.authlete.common.types.User) Date(java.util.Date) Result(com.authlete.common.dto.BackchannelAuthenticationCompleteRequest.Result) BackchannelAuthenticationCompleteRequestHandler(com.authlete.jaxrs.BackchannelAuthenticationCompleteRequestHandler)

Aggregations

Result (com.authlete.common.dto.BackchannelAuthenticationCompleteRequest.Result)1 User (com.authlete.common.types.User)1 BackchannelAuthenticationCompleteRequestHandler (com.authlete.jaxrs.BackchannelAuthenticationCompleteRequestHandler)1 Date (java.util.Date)1