use of com.authlete.common.types.User in project java-oauth-server by authlete.
the class DeviceVerificationRequestHandlerSpiImpl method onNotExist.
@Override
public Response onNotExist() {
// Urge the user to re-input a valid user code.
// The user.
User user = (User) mSession.getAttribute("user");
// The model for rendering the verification page.
DeviceVerificationPageModel model = new DeviceVerificationPageModel().setUserCode(mUserCode).setUser(user).setNotification("The user code does not exist.");
// urge the user to re-input a valid user code.
return notFound(new Viewable(VERIFICATION_PAGE_TEMPLATE, model));
}
use of com.authlete.common.types.User 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();
}
use of com.authlete.common.types.User in project java-oauth-server by authlete.
the class DeviceCompleteEndpoint method post.
/**
* Process a request from the form in the authorization page in OAuth 2.0
* Device Authorization Grant (Device Flow).
*/
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response post(@Context HttpServletRequest request, MultivaluedMap<String, String> parameters) {
// Get the existing session.
HttpSession session = getSession(request);
// Get the information from the session.
String userCode = getUserCode(session);
User user = getUser(session);
Date authTime = (Date) session.getAttribute("authTime");
String[] claimNames = (String[]) takeAttribute(session, "claimNames");
String[] acrs = (String[]) takeAttribute(session, "acrs");
// Handle the device complete request.
return handle(parameters, user, authTime, acrs, userCode, claimNames);
}
Aggregations