Search in sources :

Example 1 with AuthInitialize

use of org.apache.geode.security.AuthInitialize in project geode by apache.

the class HandShake method getCredentials.

public static Properties getCredentials(String authInitMethod, Properties securityProperties, DistributedMember server, boolean isPeer, InternalLogWriter logWriter, InternalLogWriter securityLogWriter) throws AuthenticationRequiredException {
    Properties credentials = null;
    // if no authInit, Try to extract the credentials directly from securityProps
    if (StringUtils.isBlank(authInitMethod)) {
        return SecurityService.getCredentials(securityProperties);
    }
    // if authInit exists
    try {
        AuthInitialize auth = SecurityService.getObjectOfType(authInitMethod, AuthInitialize.class);
        auth.init(logWriter, securityLogWriter);
        try {
            credentials = auth.getCredentials(securityProperties, server, isPeer);
        } finally {
            auth.close();
        }
    } catch (GemFireSecurityException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new AuthenticationRequiredException(LocalizedStrings.HandShake_FAILED_TO_ACQUIRE_AUTHINITIALIZE_METHOD_0.toLocalizedString(authInitMethod), ex);
    }
    return credentials;
}
Also used : GemFireSecurityException(org.apache.geode.security.GemFireSecurityException) AuthenticationRequiredException(org.apache.geode.security.AuthenticationRequiredException) Properties(java.util.Properties) ServerRefusedConnectionException(org.apache.geode.cache.client.ServerRefusedConnectionException) GemFireSecurityException(org.apache.geode.security.GemFireSecurityException) InternalGemFireException(org.apache.geode.InternalGemFireException) GatewayConfigurationException(org.apache.geode.cache.GatewayConfigurationException) EOFException(java.io.EOFException) AuthenticationFailedException(org.apache.geode.security.AuthenticationFailedException) GemFireConfigException(org.apache.geode.GemFireConfigException) IOException(java.io.IOException) AuthenticationRequiredException(org.apache.geode.security.AuthenticationRequiredException) AuthInitialize(org.apache.geode.security.AuthInitialize)

Aggregations

EOFException (java.io.EOFException)1 IOException (java.io.IOException)1 Properties (java.util.Properties)1 GemFireConfigException (org.apache.geode.GemFireConfigException)1 InternalGemFireException (org.apache.geode.InternalGemFireException)1 GatewayConfigurationException (org.apache.geode.cache.GatewayConfigurationException)1 ServerRefusedConnectionException (org.apache.geode.cache.client.ServerRefusedConnectionException)1 AuthInitialize (org.apache.geode.security.AuthInitialize)1 AuthenticationFailedException (org.apache.geode.security.AuthenticationFailedException)1 AuthenticationRequiredException (org.apache.geode.security.AuthenticationRequiredException)1 GemFireSecurityException (org.apache.geode.security.GemFireSecurityException)1