use of com.yubico.u2f.data.messages.SignRequest 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 SignRequestData requestData = u2f.startSignature(this.serverAddress, u2FDeviceRepository.getRegisteredDevices(p.getId()));
u2FDeviceRepository.requestDeviceAuthentication(requestData.getRequestId(), p.getId(), requestData.toJson());
if (!requestData.getSignRequests().isEmpty()) {
final SignRequest req = requestData.getSignRequests().get(0);
requestContext.getFlowScope().put("u2fAuth", new U2FAuthentication(req.getChallenge(), req.getAppId(), req.getKeyHandle()));
return success();
}
return error();
}
Aggregations