Search in sources :

Example 1 with Hash

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();
}
Also used : User(com.authy.api.User) Hash(com.authy.api.Hash) Principal(org.apereo.cas.authentication.principal.Principal)

Aggregations

Hash (com.authy.api.Hash)1 User (com.authy.api.User)1 Principal (org.apereo.cas.authentication.principal.Principal)1