Search in sources :

Example 1 with PlainServerCallbackHandler

use of org.apache.kafka.common.security.plain.internals.PlainServerCallbackHandler in project kafka by apache.

the class SaslChannelBuilder method createServerCallbackHandlers.

private void createServerCallbackHandlers(Map<String, ?> configs) {
    for (String mechanism : jaasContexts.keySet()) {
        AuthenticateCallbackHandler callbackHandler;
        String prefix = ListenerName.saslMechanismPrefix(mechanism);
        @SuppressWarnings("unchecked") Class<? extends AuthenticateCallbackHandler> clazz = (Class<? extends AuthenticateCallbackHandler>) configs.get(prefix + BrokerSecurityConfigs.SASL_SERVER_CALLBACK_HANDLER_CLASS);
        if (clazz != null)
            callbackHandler = Utils.newInstance(clazz);
        else if (mechanism.equals(PlainSaslServer.PLAIN_MECHANISM))
            callbackHandler = new PlainServerCallbackHandler();
        else if (ScramMechanism.isScram(mechanism))
            callbackHandler = new ScramServerCallbackHandler(credentialCache.cache(mechanism, ScramCredential.class), tokenCache);
        else if (mechanism.equals(OAuthBearerLoginModule.OAUTHBEARER_MECHANISM))
            callbackHandler = new OAuthBearerUnsecuredValidatorCallbackHandler();
        else
            callbackHandler = new SaslServerCallbackHandler();
        saslCallbackHandlers.put(mechanism, callbackHandler);
    }
}
Also used : OAuthBearerUnsecuredValidatorCallbackHandler(org.apache.kafka.common.security.oauthbearer.internals.unsecured.OAuthBearerUnsecuredValidatorCallbackHandler) ScramCredential(org.apache.kafka.common.security.scram.ScramCredential) ScramServerCallbackHandler(org.apache.kafka.common.security.scram.internals.ScramServerCallbackHandler) PlainServerCallbackHandler(org.apache.kafka.common.security.plain.internals.PlainServerCallbackHandler) SaslServerCallbackHandler(org.apache.kafka.common.security.authenticator.SaslServerCallbackHandler) AuthenticateCallbackHandler(org.apache.kafka.common.security.auth.AuthenticateCallbackHandler)

Aggregations

AuthenticateCallbackHandler (org.apache.kafka.common.security.auth.AuthenticateCallbackHandler)1 SaslServerCallbackHandler (org.apache.kafka.common.security.authenticator.SaslServerCallbackHandler)1 OAuthBearerUnsecuredValidatorCallbackHandler (org.apache.kafka.common.security.oauthbearer.internals.unsecured.OAuthBearerUnsecuredValidatorCallbackHandler)1 PlainServerCallbackHandler (org.apache.kafka.common.security.plain.internals.PlainServerCallbackHandler)1 ScramCredential (org.apache.kafka.common.security.scram.ScramCredential)1 ScramServerCallbackHandler (org.apache.kafka.common.security.scram.internals.ScramServerCallbackHandler)1