Spring3 Security???????????
???????????? ???????[ 2016/5/16 14:11:40 ] ???????????ù??? ??????????
???????????????????????????????????????е????????????
????1.??web.xml??????HttpSessionEventPublisher
????<listener>
????<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
????</listener>
????2.??security.xml??????session management
????session-management???????http?????
????<session-management invalid-session-url="/login?invalid_session">
????<concurrency-control max-sessions="1" error-if-maximum-exceeded="false" expired-url="/login?expired"/>
????</session-management>
???????е?"max-session"????????session?????????????1;"error-if-maximum-exceeded"?????????false???????????????????????????????????true????????????????????????????????????
????3.??дuser?????????е?equals??hashCode?????????????UserDetails??????д??equals??hashCode????
User.java
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof User)) return false;
User that = (User) o;
if (guid != null ? !guid.equals(that.guid) : that.guid != null) return false;
return true;
}
@Override
public int hashCode() {
return guid != null ? guid.hashCode() : 0;
}
StUserDetails.java
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof StUserDetails)) return false;
StUserDetails that = (StUserDetails) o;
if (grantedAuthorities != null ? !grantedAuthorities.equals(that.grantedAuthorities) : that.grantedAuthorities != null)
return false;
if (user != null ? !user.equals(that.user) : that.user != null) return false;
return true;
}
@Override
public int hashCode() {
int result = user != null ? user.hashCode() : 0;
result = 31 * result + (grantedAuthorities != null ? grantedAuthorities.hashCode() : 0);
return result;
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11