Spring 将安全xml转换为代码
我有一个如下的xml代码Spring 将安全xml转换为代码,spring,spring-mvc,spring-security,Spring,Spring Mvc,Spring Security,我有一个如下的xml代码 <http auto-config="false" use-expressions="true" create-session="ifRequired" entry-point-ref="loginUrlAuthenticationEntryPoint"> <custom-filter position="FORM_LOGIN_FILTER" ref="authenticationProcessingFilter" />
<http auto-config="false" use-expressions="true" create-session="ifRequired" entry-point-ref="loginUrlAuthenticationEntryPoint">
<custom-filter position="FORM_LOGIN_FILTER" ref="authenticationProcessingFilter" />
<custom-filter before="PRE_AUTH_FILTER" ref="socialAuthenticationFilter" />
<intercept-url pattern="/blah/404-error" access="permitAll()" />
<intercept-url pattern="/blah/500-error" access="permitAll()" />
<intercept-url pattern="/**" access="isAuthenticated()" />
<remember-me services-ref="rememberMeServices" key="blah" />
<logout logout-url="/blah/logout" logout-success-url="/blah/signin" />
</http>
<beans:bean id="authenticationProcessingFilter" class="in.security.ReCaptchaAuthenticationFilter">
<beans:property name="authenticationManager" ref="authenticationManager" />
<beans:property name="filterProcessesUrl" value="/blah/authentication" />
<beans:property name="authenticationSuccessHandler" ref="authenticationSuccessHandler" />
<beans:property name="authenticationFailureHandler" ref="authenticationFailureHandler" />
<beans:property name="privateKey" value="key" />
</beans:bean>
我通常可以看到示例代码包含以下内容
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and()
.withUser("admin").password("password").roles("USER", "ADMIN");
或
但我既不使用内存身份验证,也不使用jdbc身份验证。但我没有使用任何这种身份验证。我正在使用过滤器。。。。
我不知道在
configureGlobal
方法中应该放什么。您可以发布authenticationProcessingFilter
定义吗?更新了过滤器定义
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and()
.withUser("admin").password("password").roles("USER", "ADMIN");
auth
.jdbcAuthentication()
.dataSource(dataSource)
.withDefaultSchema()
.withUser("user").password("password").roles("USER").and()
.withUser("admin").password("password").roles("USER", "ADMIN");