Search in sources :

Example 1 with U2FRegistration

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

the class U2FStartRegistrationAction method doExecute.

@Override
protected Event doExecute(final RequestContext requestContext) throws Exception {
    final Principal p = WebUtils.getAuthentication(requestContext).getPrincipal();
    final RegisterRequestData registerRequestData = u2f.startRegistration(this.serverAddress, u2FDeviceRepository.getRegisteredDevices(p.getId()));
    u2FDeviceRepository.requestDeviceRegistration(registerRequestData.getRequestId(), p.getId(), registerRequestData.toJson());
    if (!registerRequestData.getRegisterRequests().isEmpty()) {
        final RegisterRequest req = registerRequestData.getRegisterRequests().iterator().next();
        requestContext.getFlowScope().put("u2fReg", new U2FRegistration(req.getChallenge(), req.getAppId()));
        return success();
    }
    return error();
}
Also used : RegisterRequest(com.yubico.u2f.data.messages.RegisterRequest) RegisterRequestData(com.yubico.u2f.data.messages.RegisterRequestData) U2FRegistration(org.apereo.cas.adaptors.u2f.U2FRegistration) Principal(org.apereo.cas.authentication.principal.Principal)

Aggregations

RegisterRequest (com.yubico.u2f.data.messages.RegisterRequest)1 RegisterRequestData (com.yubico.u2f.data.messages.RegisterRequestData)1 U2FRegistration (org.apereo.cas.adaptors.u2f.U2FRegistration)1 Principal (org.apereo.cas.authentication.principal.Principal)1