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

The following examples show how to use org.springframework.security.kerberos.authentication.sun.SunJaasKerberosTicketValidator. 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: 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 #2
Source File: WebSecurityConfig.java    From Hacktoberfest2019 with Apache License 2.0 5 votes vote down vote up
@Bean
public SunJaasKerberosTicketValidator sunJaasKerberosTicketValidator() {
    SunJaasKerberosTicketValidator ticketValidator = new SunJaasKerberosTicketValidator();
    ticketValidator.setServicePrincipal(servicePrincipal);
    ticketValidator.setKeyTabLocation(new FileSystemResource(keytabLocation));
    ticketValidator.setDebug(true);
    return ticketValidator;
}
 
Example #3
Source File: KerberosServiceFactoryBean.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
private KerberosTicketValidator createTicketValidator() throws Exception {
    SunJaasKerberosTicketValidator ticketValidator = new SunJaasKerberosTicketValidator();
    ticketValidator.setServicePrincipal(properties.getKerberosSpnegoPrincipal());
    ticketValidator.setKeyTabLocation(new FileSystemResource(properties.getKerberosSpnegoKeytabLocation()));
    ticketValidator.afterPropertiesSet();
    return ticketValidator;
}
 
Example #4
Source File: InsightsSecurityConfigurationAdapterKerberos.java    From Insights with Apache License 2.0 5 votes vote down vote up
/**
 * Default Kerberos ticket validator
 * 
 * @return
 */
@Bean
@Conditional(InsightsKerberosBeanInitializationCondition.class)
public SunJaasKerberosTicketValidator sunJaasKerberosTicketValidator() {
	Resource storeFile = resourceLoaderService
			.getResource("file:" + singleSignOnConfig.getKeyTabLocationKerberos());
	SunJaasKerberosTicketValidator ticketValidator = new SunJaasKerberosTicketValidator();
	ticketValidator.setServicePrincipal(singleSignOnConfig.getServicePrincipalKerberos());
	ticketValidator.setKeyTabLocation(storeFile);
	ticketValidator.setDebug(true);
	return ticketValidator;
}
 
Example #5
Source File: KerberosServiceFactoryBean.java    From nifi with Apache License 2.0 5 votes vote down vote up
private KerberosTicketValidator createTicketValidator() throws Exception {
    SunJaasKerberosTicketValidator ticketValidator = new SunJaasKerberosTicketValidator();
    ticketValidator.setServicePrincipal(properties.getKerberosSpnegoPrincipal());
    ticketValidator.setKeyTabLocation(new FileSystemResource(properties.getKerberosSpnegoKeytabLocation()));
    ticketValidator.afterPropertiesSet();
    return ticketValidator;
}
 
Example #6
Source File: WebSecurityConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public SunJaasKerberosTicketValidator sunJaasKerberosTicketValidator() {
    SunJaasKerberosTicketValidator ticketValidator = new SunJaasKerberosTicketValidator();
    ticketValidator.setServicePrincipal("HTTP/[email protected]");
    ticketValidator.setKeyTabLocation(new FileSystemResource("baeldung.keytab"));
    ticketValidator.setDebug(true);
    return ticketValidator;
}
 
Example #7
Source File: WebSecurityConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public SunJaasKerberosTicketValidator sunJaasKerberosTicketValidator() {
	SunJaasKerberosTicketValidator ticketValidator = new SunJaasKerberosTicketValidator();
	ticketValidator.setServicePrincipal(servicePrincipal);
	ticketValidator.setKeyTabLocation(new FileSystemResource(keytabLocation));
	ticketValidator.setDebug(true);
	return ticketValidator;
}