开发者

Spring Security Log Out Exception

开发者 https://www.devze.com 2023-02-17 22:06 出处:网络
When I configure Spring Security 3 to log out the user I get a huge error Exception in thread \"\"http-bio-8080\"-exec-7\" java.lang.StackOverflowError

When I configure Spring Security 3 to log out the user I get a huge error

Exception in thread ""http-bio-8080"-exec-7" java.lang.StackOverflowError at com.dc.api.model.Users.getUsername(Users.java:200)

The Users.java:200 maps to the org.springframework.security.core.userdetails.UserDetails implementation method

public String 开发者_运维知识库getUsername() {
    return this.getUsername();
}

log out link:

<a href="${facesContext.externalContext.requestContextPath}/j_spring_security_logout.html">
log out</a>

spring security config:

 <logout invalidate-session="true" 
          logout-success-url="/" 
          logout-url="/j_spring_security_logout.html"/>

web.xml:

I've configured the springSecurityFilterChain to run on any forward or request to *.html and *.xhtml


The issue here was the below method thats called by spring security was calling itself and was in an infinite loop. It should be calling my User model object's userId (this.getUserId)

public String getUsername() {
    return this.getUsername();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消