Search in sources :

Example 1 with DigestCredential

use of org.wildfly.extension.undertow.security.digest.DigestCredential in project wildfly by wildfly.

the class JAASIdentityManagerImpl method verify.

@Override
public Account verify(String id, Credential credential) {
    AccountImpl account = getAccount(id);
    if (credential instanceof DigestCredential) {
        DigestCredential digestCredential = (DigestCredential) credential;
        DigestCallbackHandler handler = new DigestCallbackHandler(id, digestCredential.getNonce(), digestCredential.getNonceCount(), digestCredential.getClientNonce(), digestCredential.getQop(), digestCredential.getRealm(), digestCredential.getHA2());
        CallbackHandlerPolicyContextHandler.setCallbackHandler(handler);
        return verifyCredential(account, digestCredential.getClientDigest());
    } else if (credential instanceof PasswordCredential) {
        final char[] password = ((PasswordCredential) credential).getPassword();
        // The original array may be cleared, this integration relies on it being cached for use later.
        final char[] duplicate = Arrays.copyOf(password, password.length);
        return verifyCredential(account, duplicate);
    } else {
        return verifyCredential(account, credential);
    }
}
Also used : DigestCredential(org.wildfly.extension.undertow.security.digest.DigestCredential) PasswordCredential(io.undertow.security.idm.PasswordCredential) DigestCallbackHandler(org.jboss.security.auth.callback.DigestCallbackHandler)

Aggregations

PasswordCredential (io.undertow.security.idm.PasswordCredential)1 DigestCallbackHandler (org.jboss.security.auth.callback.DigestCallbackHandler)1 DigestCredential (org.wildfly.extension.undertow.security.digest.DigestCredential)1