草庐IT

AuthenticationManagerBuilder

全部标签

java - 在内存中和自定义提供程序一起

我正在设置我的SpringSecurity(v4.0.1)Web应用程序。我想要两个身份验证提供程序,一个用于管理管理员帐户的“内存中”提供程序和一个引用我自己的实现的自定义提供程序。系统应首先尝试针对“内存中”提供者进行身份验证,然后再针对自定义提供者进行身份验证。我的代码如下所示:@AutowiredpublicvoidconfigureGlobal(AuthenticationManagerBuilderauth,AuthenticationProviderprovider)throwsException{auth.inMemoryAuthentication().withUse

java - 使用具有不同 AuthenticationProviders 的多个 WebSecurityConfigurerAdapter(API 的基本身份验证和 Web 应用的 LDAP)

根据SpringSecurityReferencesection5.7应该可以定义多个安全适配器。我尝试做同样的事情,但没有成功。服务器重新启动后,API的前x次使用基本身份验证正常工作,但几次后我被重定向到登录(表单)页面,这应该只发生在我们的Web应用程序,而不是API调用。我的代码:@EnableWebSecuritypublicclassMultiHttpSecurityConfig{@Configuration@Order(1)publicstaticclassApiWebSecurityConfigurationAdapterextendsWebSecurityConfig

java - 使用具有不同 AuthenticationProviders 的多个 WebSecurityConfigurerAdapter(API 的基本身份验证和 Web 应用的 LDAP)

根据SpringSecurityReferencesection5.7应该可以定义多个安全适配器。我尝试做同样的事情,但没有成功。服务器重新启动后,API的前x次使用基本身份验证正常工作,但几次后我被重定向到登录(表单)页面,这应该只发生在我们的Web应用程序,而不是API调用。我的代码:@EnableWebSecuritypublicclassMultiHttpSecurityConfig{@Configuration@Order(1)publicstaticclassApiWebSecurityConfigurationAdapterextendsWebSecurityConfig

java - Spring Security 如何添加/配置 AuthenticationManagerBuilder?

我正在研究基于SpringSecurityJava的配置。我已经创建了我自己的MyAuthenticationProvider,我想在ProviderManager中注册它(AuthenticationManager的单个实例)。我发现ProviderManager有一个提供商列表,我可以在其中注册我的单例MyAuthenticationProvider.这是我的配置的一部分:@Configuration@EnableWebSecuritypublicclassSecurityConfigextendsWebSecurityConfigurerAdapter{@Autowiredpub