org.springframework.security.kerberos.authentication.sun.GlobalSunJaasKerberosConfig Java Examples

The following examples show how to use org.springframework.security.kerberos.authentication.sun.GlobalSunJaasKerberosConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KerberosServiceFactoryBean.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Override
public KerberosService getObject() throws Exception {
    if (kerberosService == null && properties.isKerberosSpnegoSupportEnabled()) {
        final File krb5ConfigFile = properties.getKerberosConfigurationFile();
        if (krb5ConfigFile != null) {
            final GlobalSunJaasKerberosConfig krb5Config = new GlobalSunJaasKerberosConfig();
            krb5Config.setKrbConfLocation(krb5ConfigFile.getAbsolutePath());
            krb5Config.afterPropertiesSet();
        }

        kerberosService = new KerberosService();
        kerberosService.setKerberosServiceAuthenticationProvider(createKerberosServiceAuthenticationProvider());
    }

    return kerberosService;
}
 
Example #2
Source File: KerberosTicketValidatorFactory.java    From nifi-registry with Apache License 2.0 6 votes vote down vote up
@Bean
public KerberosTicketValidator kerberosTicketValidator() throws Exception {

    if (kerberosTicketValidator == null && properties.isKerberosSpnegoSupportEnabled()) {

        // Configure SunJaasKerberos (global)
        final File krb5ConfigFile = properties.getKerberosConfigurationFile();
        if (krb5ConfigFile != null) {
            final GlobalSunJaasKerberosConfig krb5Config = new GlobalSunJaasKerberosConfig();
            krb5Config.setKrbConfLocation(krb5ConfigFile.getAbsolutePath());
            krb5Config.afterPropertiesSet();
        }

        // Create ticket validator to inject into KerberosServiceAuthenticationProvider
        SunJaasKerberosTicketValidator ticketValidator = new SunJaasKerberosTicketValidator();
        ticketValidator.setServicePrincipal(properties.getKerberosSpnegoPrincipal());
        ticketValidator.setKeyTabLocation(new FileSystemResource(properties.getKerberosSpnegoKeytabLocation()));
        ticketValidator.afterPropertiesSet();

        kerberosTicketValidator = ticketValidator;

    }

    return kerberosTicketValidator;

}
 
Example #3
Source File: KerberosServiceFactoryBean.java    From nifi with Apache License 2.0 6 votes vote down vote up
@Override
public KerberosService getObject() throws Exception {
    if (kerberosService == null && properties.isKerberosSpnegoSupportEnabled()) {
        final File krb5ConfigFile = properties.getKerberosConfigurationFile();
        if (krb5ConfigFile != null) {
            final GlobalSunJaasKerberosConfig krb5Config = new GlobalSunJaasKerberosConfig();
            krb5Config.setKrbConfLocation(krb5ConfigFile.getAbsolutePath());
            krb5Config.afterPropertiesSet();
        }

        kerberosService = new KerberosService();
        kerberosService.setKerberosServiceAuthenticationProvider(createKerberosServiceAuthenticationProvider());
    }

    return kerberosService;
}