65         EventBuilder 
event = context.getEvent();
    66         event.event(EventType.UPDATE_TOTP);
    67         MultivaluedMap<String, String> formData = context.getHttpRequest().getDecodedFormParameters();
    68         String totp = formData.getFirst(
"totp");
    69         String totpSecret = context.getAuthenticationSession().getAuthNote(
"totpSecret");
    71         if (Validation.isBlank(totp)) {
    73                     challenge(context).message(Messages.MISSING_TOTP)
    76         } 
else if (!CredentialValidation.validOTP(context.getRealm(), totp, totpSecret)) {
    78                     challenge(context).message(Messages.INVALID_TOTP)
    83         UserCredentialModel credentials = 
new UserCredentialModel();
    84         credentials.setType(context.getRealm().getOTPPolicy().getType());
    85         credentials.setValue(totpSecret);
    86         context.getSession().userCredentialManager().updateCredential(context.getRealm(), context.getUser(), credentials);
    90         UserCredentialModel cred = 
new UserCredentialModel();
    91         cred.setType(context.getRealm().getOTPPolicy().getType());
    93         context.getSession().userCredentialManager().isValid(context.getRealm(), context.getUser(), cred);
    95         context.getAuthenticationSession().removeAuthNote(
"totpSecret");
 ConsoleDisplayMode challenge(RequiredActionContext context)
Definition: ConsoleUpdateTotp.java:55