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();
}
Aggregations