use of com.authy.api.Hash in project cas by apereo.
the class AuthyAuthenticationRegistrationWebflowAction method doExecute.
@Override
protected Event doExecute(final RequestContext context) {
final Principal principal = WebUtils.getAuthentication(context).getPrincipal();
final User user = instance.getOrCreateUser(principal);
if (!user.isOk()) {
throw new IllegalArgumentException(AuthyClientInstance.getErrorMessage(user.getError()));
}
final Hash h = instance.getAuthyUsers().requestSms(user.getId());
if (!h.isOk() || !h.isSuccess()) {
throw new IllegalArgumentException(AuthyClientInstance.getErrorMessage(h.getError()).concat(h.getMessage()));
}
return success();
}