Search in sources :

Example 1 with SunJaasKerberosClient

use of org.springframework.security.kerberos.authentication.sun.SunJaasKerberosClient in project nifi by apache.

the class KerberosProvider method onConfigured.

@Override
public final void onConfigured(final LoginIdentityProviderConfigurationContext configurationContext) throws ProviderCreationException {
    final String rawExpiration = configurationContext.getProperty("Authentication Expiration");
    if (StringUtils.isBlank(rawExpiration)) {
        throw new ProviderCreationException("The Authentication Expiration must be specified.");
    }
    try {
        expiration = FormatUtils.getTimeDuration(rawExpiration, TimeUnit.MILLISECONDS);
    } catch (final IllegalArgumentException iae) {
        throw new ProviderCreationException(String.format("The Expiration Duration '%s' is not a valid time duration", rawExpiration));
    }
    provider = new KerberosAuthenticationProvider();
    SunJaasKerberosClient client = new SunJaasKerberosClient();
    client.setDebug(true);
    provider.setKerberosClient(client);
    provider.setUserDetailsService(new KerberosUserDetailsService());
}
Also used : ProviderCreationException(org.apache.nifi.authentication.exception.ProviderCreationException) KerberosAuthenticationProvider(org.springframework.security.kerberos.authentication.KerberosAuthenticationProvider) SunJaasKerberosClient(org.springframework.security.kerberos.authentication.sun.SunJaasKerberosClient)

Example 2 with SunJaasKerberosClient

use of org.springframework.security.kerberos.authentication.sun.SunJaasKerberosClient in project nifi-registry by apache.

the class KerberosIdentityProvider method onConfigured.

@Override
public void onConfigured(IdentityProviderConfigurationContext configurationContext) throws SecurityProviderCreationException {
    String rawDebug = configurationContext.getProperty("Enable Debug");
    boolean enableDebug = (rawDebug != null && rawDebug.equalsIgnoreCase("true"));
    String rawExpiration = configurationContext.getProperty("Authentication Expiration");
    if (StringUtils.isBlank(rawExpiration)) {
        rawExpiration = default_expiration;
        logger.info("No Authentication Expiration specified, defaulting to " + default_expiration);
    }
    try {
        expiration = FormatUtils.getTimeDuration(rawExpiration, TimeUnit.MILLISECONDS);
    } catch (final IllegalArgumentException iae) {
        throw new SecurityProviderCreationException(String.format("The Expiration Duration '%s' is not a valid time duration", rawExpiration));
    }
    provider = new KerberosAuthenticationProvider();
    SunJaasKerberosClient client = new SunJaasKerberosClient();
    client.setDebug(enableDebug);
    provider.setKerberosClient(client);
    provider.setUserDetailsService(new KerberosUserDetailsService());
}
Also used : SecurityProviderCreationException(org.apache.nifi.registry.security.exception.SecurityProviderCreationException) KerberosAuthenticationProvider(org.springframework.security.kerberos.authentication.KerberosAuthenticationProvider) SunJaasKerberosClient(org.springframework.security.kerberos.authentication.sun.SunJaasKerberosClient)

Aggregations

KerberosAuthenticationProvider (org.springframework.security.kerberos.authentication.KerberosAuthenticationProvider)2 SunJaasKerberosClient (org.springframework.security.kerberos.authentication.sun.SunJaasKerberosClient)2 ProviderCreationException (org.apache.nifi.authentication.exception.ProviderCreationException)1 SecurityProviderCreationException (org.apache.nifi.registry.security.exception.SecurityProviderCreationException)1