mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-15 04:52:09 +08:00
#I844NY 消除Session与Authentication来回嵌套
This commit is contained in:
@@ -32,7 +32,7 @@ public class SignPrincipal implements UserDetails {
|
||||
|
||||
UserDetails userDetails;
|
||||
|
||||
Session session;
|
||||
String sessionId;
|
||||
ArrayList<GrantedAuthority> grantedAuthority;
|
||||
ArrayList<GrantedAuthority> grantedAuthorityApps;
|
||||
boolean authenticated;
|
||||
@@ -71,7 +71,7 @@ public class SignPrincipal implements UserDetails {
|
||||
this.accountNonLocked = true;
|
||||
this.credentialsNonExpired =true;
|
||||
this.enabled = true;
|
||||
this.session = session;
|
||||
this.sessionId = session.getId();
|
||||
this.userInfo.setSessionId(session.getId());
|
||||
}
|
||||
|
||||
@@ -120,13 +120,6 @@ public class SignPrincipal implements UserDetails {
|
||||
this.grantedAuthority = grantedAuthority;
|
||||
}
|
||||
|
||||
public Session getSession() {
|
||||
return session;
|
||||
}
|
||||
|
||||
public void setSession(Session session) {
|
||||
this.session = session;
|
||||
}
|
||||
|
||||
public boolean isRoleAdministrators() {
|
||||
return roleAdministrators;
|
||||
@@ -152,7 +145,16 @@ public class SignPrincipal implements UserDetails {
|
||||
return this.credentialsNonExpired;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
@@ -192,8 +194,6 @@ public class SignPrincipal implements UserDetails {
|
||||
builder.append(userInfo);
|
||||
builder.append(", userDetails=");
|
||||
builder.append(userDetails);
|
||||
builder.append(", session=");
|
||||
builder.append(session);
|
||||
builder.append(", grantedAuthority=");
|
||||
builder.append(grantedAuthority);
|
||||
builder.append(", grantedAuthorityApps=");
|
||||
|
||||
@@ -89,7 +89,7 @@ public class AuthJwt implements Serializable {
|
||||
this.expiresIn = expiresIn;
|
||||
this.refreshToken = refreshToken;
|
||||
|
||||
this.ticket = principal.getSession().getId();
|
||||
this.ticket = principal.getSessionId();
|
||||
this.id = principal.getUserInfo().getId();
|
||||
this.username = principal.getUserInfo().getUsername();
|
||||
this.name = this.username;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class AuthJwtService {
|
||||
JWTClaimsSet jwtClaims =new JWTClaimsSet.Builder()
|
||||
.issuer(issuer)
|
||||
.subject(subject)
|
||||
.jwtID(principal.getSession().getId())
|
||||
.jwtID(principal.getSessionId())
|
||||
.issueTime(currentDateTime.toDate())
|
||||
.expirationTime(expirationTime)
|
||||
.claim("locale", userInfo.getLocale())
|
||||
|
||||
@@ -65,7 +65,7 @@ public class HttpSessionListenerAdapter implements HttpSessionListener {
|
||||
session.getId(),
|
||||
signPrincipal.getUserInfo().getId(),
|
||||
signPrincipal.getUserInfo().getUsername(),
|
||||
signPrincipal.getSession().getId());
|
||||
signPrincipal.getSessionId());
|
||||
}else if(principal instanceof User) {
|
||||
User user = (User)principal;
|
||||
_logger.trace("{} HttpSession Id {} for username {} password {} Destroyed" ,
|
||||
|
||||
Reference in New Issue
Block a user