use of org.springframework.security.kerberos.authentication.KerberosAuthenticationProvider 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());
}
use of org.springframework.security.kerberos.authentication.KerberosAuthenticationProvider 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());
}
Aggregations