@Override
        public void handle(Callback[] callbacks) {
            String username = null;
            for (Callback callback : callbacks) {
                if (callback instanceof NameCallback) {
                    NameCallback nameCallback = (NameCallback) callback;
                    if (TestJaasConfig.USERNAME.equals(nameCallback.getDefaultName())) {
                        nameCallback.setName(nameCallback.getDefaultName());
                        username = TestJaasConfig.USERNAME;
                    }
                } else if (callback instanceof PasswordCallback) {
                    PasswordCallback passwordCallback = (PasswordCallback) callback;
                    if (TestJaasConfig.USERNAME.equals(username))
                        passwordCallback.setPassword(TestJaasConfig.PASSWORD.toCharArray());
                } else if (callback instanceof RealmCallback) {
                    RealmCallback realmCallback = (RealmCallback) callback;
                    realmCallback.setText(realmCallback.getDefaultText());
                } else if (callback instanceof AuthorizeCallback) {
                    AuthorizeCallback authCallback = (AuthorizeCallback) callback;
                    if (TestJaasConfig.USERNAME.equals(authCallback.getAuthenticationID())) {
                        authCallback.setAuthorized(true);
                        authCallback.setAuthorizedID(authCallback.getAuthenticationID());
                    }
                }
            }
        }
Digest-MD5 login module for multi-mechanism tests.
This login module uses the same format as PlainLoginModule and hence simply reuses the same methods.
clients/src/test/java/org/apache/kafka/common/security/authenticator/TestDigestLoginModule.java