mirror of https://gitee.com/maxjhandsome/pig
✨ 添加新特性。 jwt token 支持获取用户ID
This commit is contained in:
parent
4f82d4801f
commit
b1f710ad87
|
@ -138,7 +138,7 @@ public class PigAuthorizationConfig extends AuthorizationServerConfigurerAdapter
|
|||
final Map<String, Object> additionalInfo = new HashMap<>(2);
|
||||
additionalInfo.put("license", SecurityConstants.PIG_LICENSE);
|
||||
UserDetailsImpl user = (UserDetailsImpl) authentication.getUserAuthentication().getPrincipal();
|
||||
if(user!=null) {
|
||||
if (user != null) {
|
||||
additionalInfo.put("userId", user.getUserId());
|
||||
}
|
||||
((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(additionalInfo);
|
||||
|
|
|
@ -43,7 +43,7 @@ public class UserDetailsImpl implements UserDetails {
|
|||
private List<SysRole> roleList;
|
||||
|
||||
public UserDetailsImpl(UserVO userVo) {
|
||||
this.userId=userVo.getUserId();
|
||||
this.userId = userVo.getUserId();
|
||||
this.username = userVo.getUsername();
|
||||
this.password = userVo.getPassword();
|
||||
this.status = userVo.getDelFlag();
|
||||
|
|
|
@ -23,8 +23,6 @@ import io.jsonwebtoken.Claims;
|
|||
import io.jsonwebtoken.Jwts;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
|
Loading…
Reference in New Issue