简体   繁体   English

从版本 3 迁移到版本 4 后,Spring Security 无法正常工作

[英]Spring Security not working after migrating from version 3 to 4

Recently I migrated from Spring Security 3 to version 4. Everything worked well before but now nothing works.最近我从 Spring Security 3 迁移到版本 4。之前一切正常,但现在没有任何效果。

Here is my spring-security.xml :这是我的spring-security.xml

<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
    http://www.springframework.org/schema/security
    http://www.springframework.org/schema/security/spring-security-4.0.xsd">

    <http auto-config="true" use-expressions="true"> 
        <intercept-url pattern="/home.MRCMPU" access="permitAll"/>
        <intercept-url pattern="/loginFailure.MRCMPU" access="permitAll"/>
        <intercept-url pattern="/*.MRCMPU"  access="permitAll"/>
        <intercept-url pattern="/con" access="permitAll"/>

        <form-login 
            login-page="/home.MRCMPU"
            login-processing-url="/login"  authentication-success-handler-ref="AuthenticationSuccess" 
            authentication-failure-handler-ref="AuthenticationFailure" username-parameter="username" password-parameter="password" />
        <logout logout-url="/logout.MRCMPU" success-handler-ref="Logout" invalidate-session="true" delete-cookies="true"/>
    </http>

    <authentication-manager>
        <authentication-provider user-service-ref="Authentication"/>
    </authentication-manager>
</beans:beans>

Can anyone find the conflict from this code?任何人都可以从这段代码中找到冲突吗?

You are missing many referrenced beans here.您在这里缺少许多引用的 bean。

  1. user-service-ref="Authentication"
  2. success-handler-ref="Logout"
  3. authentication-success-handler-ref="AuthenticationSuccess"
  4. authentication-failure-handler-ref="AuthenticationFailure"

For the above mentioned references,you should have beans otherwise,like对于上面提到的参考文献,否则你应该有豆子,比如

No bean named 'Logout' is defined未定义名为“Logout”的 bean

Exception will be thrown.将抛出异常。

Add bean class like添加bean类,如

<bean id="Authentication"
     class="class which you need to refer">
 </bean>

finally i cleared it myself.最后我自己清除了它。 by disabling csrf using xml通过使用 xml 禁用 csrf

 <csrf disabled="true"/>

but how can i do it without disabling csrf token但是我怎么能在不禁用 csrf 令牌的情况下做到这一点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从 Spring Security 迁移到 Oracle Access Manager - Migrating From Spring Security to Oracle Access Manager 将应用程序从Spring Security 3迁移到4,面临RoleVoter类的问题 - Migrating application from spring security 3 to 4, facing issue with RoleVoter class 将Spring Security 2迁移到3时出错 - Error while Migrating Spring Security 2 to 3 将 Spring Security AbstractAuthenticationProcessingFilter 迁移到 WebFlux - Migrating Spring Security AbstractAuthenticationProcessingFilter to WebFlux 从Spring Boot 1迁移到Spring Boot 2后的性能问题 - Performance issues after migrating from Spring Boot 1 to Spring Boot 2 从 Spring security 3 升级到 Spring security 4 后出现异常? - Getting exceptions after upgrade from Spring security 3 to Spring security 4? 次要版本更新后的Spring Security异常:“请确保在共享的ApplicationContext中配置了Spring Security和Spring MVC” - Spring Security exception after minor version update: “Please ensure Spring Security & Spring MVC are configured in a shared ApplicationContext” Spring / Spring Security版本升级后未调用Spring Security定制身份验证器 - Spring security custom Authenticator not called after spring/spring security version upgrade 春季安全性和GAE版本 - spring security and GAE version 从春季3迁移到4 - Migrating from spring 3 to 4
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM