KerberosAuthenticationProvider 与 KerberosServiceAuthenticationProvider
KerberosAuthenticationProvider vs. KerberosServiceAuthenticationProvider
呜呜呜!
我在我的项目中使用 Spring Security 5 和 Kerberos 进行 SSO 身份验证。
在WebSecurityConfig
我注册了两个AuthenticationProvider
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(msfUserDetailsService).passwordEncoder(passwordEncoder());
assertThatUnlimitedCryptographyEnabled();
// Two providers
auth.authenticationProvider(kerberosAuthenticationProvider());
auth.authenticationProvider(kerberosServiceAuthenticationProvider());
}
这似乎是这两个示例中的完成方式:
- https://docs.spring.io/spring-security-kerberos/docs/current/reference/html/ssk-spnego.html
- https://www.ebayinc.com/stories/blogs/tech/customizing-spring-security-with-multiple-authentications/
但是我不明白为什么我需要它们。在身份验证期间,KerberosServiceAuthenticationProvider
是验证 Kerberos 票证的那个(请参阅 JavaDoc)
然而 KerberosAuthenticationProvider
是做什么用的? JavaDoc 在这种情况下只是说
AuthenticationProvider for kerberos.
正如您所说:KerberosServiceAuthenticationProvider
用于验证 SSO 身份验证中的票证,而 KerberosAuthenticationProvider
用于基于表单的身份验证,通常在客户端不支持 SSO 时用作回退端(例如 linux 系统上的浏览器)。这种类型的身份验证由 UsernamePasswordAuthenticationFilter
处理,它应用于 WebSecurityConfigurerAdapter
:
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
...
.formLogin()
...
}
...
}
如果您不使用表单登录,那么您可以按照注释中的指示省略此提供程序。
呜呜呜!
我在我的项目中使用 Spring Security 5 和 Kerberos 进行 SSO 身份验证。
在WebSecurityConfig
我注册了两个AuthenticationProvider
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(msfUserDetailsService).passwordEncoder(passwordEncoder());
assertThatUnlimitedCryptographyEnabled();
// Two providers
auth.authenticationProvider(kerberosAuthenticationProvider());
auth.authenticationProvider(kerberosServiceAuthenticationProvider());
}
这似乎是这两个示例中的完成方式:
- https://docs.spring.io/spring-security-kerberos/docs/current/reference/html/ssk-spnego.html
- https://www.ebayinc.com/stories/blogs/tech/customizing-spring-security-with-multiple-authentications/
但是我不明白为什么我需要它们。在身份验证期间,KerberosServiceAuthenticationProvider
是验证 Kerberos 票证的那个(请参阅 JavaDoc)
然而 KerberosAuthenticationProvider
是做什么用的? JavaDoc 在这种情况下只是说
AuthenticationProvider for kerberos.
正如您所说:KerberosServiceAuthenticationProvider
用于验证 SSO 身份验证中的票证,而 KerberosAuthenticationProvider
用于基于表单的身份验证,通常在客户端不支持 SSO 时用作回退端(例如 linux 系统上的浏览器)。这种类型的身份验证由 UsernamePasswordAuthenticationFilter
处理,它应用于 WebSecurityConfigurerAdapter
:
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
...
.formLogin()
...
}
...
}
如果您不使用表单登录,那么您可以按照注释中的指示省略此提供程序。