Search in sources :

Example 1 with U2FAuthentication

use of org.apereo.cas.adaptors.u2f.U2FAuthentication in project cas by apereo.

the class U2FStartAuthenticationAction method doExecute.

@Override
protected Event doExecute(final RequestContext requestContext) throws Exception {
    final Principal p = WebUtils.getAuthentication(requestContext).getPrincipal();
    final AuthenticateRequestData requestData = u2f.startAuthentication(this.serverAddress, u2FDeviceRepository.getRegisteredDevices(p.getId()));
    u2FDeviceRepository.requestDeviceAuthentication(requestData.getRequestId(), p.getId(), requestData.toJson());
    if (!requestData.getAuthenticateRequests().isEmpty()) {
        final AuthenticateRequest req = requestData.getAuthenticateRequests().iterator().next();
        requestContext.getFlowScope().put("u2fAuth", new U2FAuthentication(req.getChallenge(), req.getAppId(), req.getKeyHandle()));
        return success();
    }
    return error();
}
Also used : U2FAuthentication(org.apereo.cas.adaptors.u2f.U2FAuthentication) AuthenticateRequest(com.yubico.u2f.data.messages.AuthenticateRequest) AuthenticateRequestData(com.yubico.u2f.data.messages.AuthenticateRequestData) Principal(org.apereo.cas.authentication.principal.Principal)

Aggregations

AuthenticateRequest (com.yubico.u2f.data.messages.AuthenticateRequest)1 AuthenticateRequestData (com.yubico.u2f.data.messages.AuthenticateRequestData)1 U2FAuthentication (org.apereo.cas.adaptors.u2f.U2FAuthentication)1 Principal (org.apereo.cas.authentication.principal.Principal)1