类改名
This commit is contained in:
parent
a109fec720
commit
4323c9394f
|
|
@ -12,7 +12,7 @@ import java.util.Collection;
|
|||
* @date 2022/9/28
|
||||
* */
|
||||
|
||||
public class EntUserDetails extends User {
|
||||
public class UserDetailsAndId extends User {
|
||||
|
||||
|
||||
private String id;
|
||||
|
|
@ -25,7 +25,7 @@ public class EntUserDetails extends User {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public EntUserDetails(String username, String password, Collection<? extends GrantedAuthority> authorities,String id) {
|
||||
public UserDetailsAndId(String username, String password, Collection<? extends GrantedAuthority> authorities,String id) {
|
||||
super(username, password, authorities);
|
||||
setId(id);
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.rzyc.service;
|
||||
|
||||
import com.rzyc.config.EntUserDetails;
|
||||
|
||||
import com.rzyc.config.UserDetailsAndId;
|
||||
import com.rzyc.mapper.AuthorityKeyMapper;
|
||||
import com.rzyc.mapper.ent.EntUserMapper;
|
||||
import com.rzyc.model.AuthorityKey;
|
||||
|
|
@ -65,7 +66,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
|
|||
stringBuilder.append(s.getCategory() +":"+s.getAuthKey());
|
||||
authority.add(new SimpleGrantedAuthority(stringBuilder.toString()));
|
||||
}
|
||||
return new EntUserDetails(entUser.getName(), passwordEncoder.encode(entUser.getPasswd()), authority,entUser.getEntUserId());
|
||||
return new UserDetailsAndId(entUser.getName(), passwordEncoder.encode(entUser.getPasswd()), authority,entUser.getEntUserId());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ package com.rzyc.service;
|
|||
|
||||
|
||||
import com.common.utils.jwt.JwtUtil;
|
||||
import com.rzyc.config.EntUserDetails;
|
||||
|
||||
import com.rzyc.config.UserDetailsAndId;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
|
|
@ -51,7 +52,7 @@ public class UserLoginService {
|
|||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
//企业用户id
|
||||
String id = ((EntUserDetails)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getId();
|
||||
String id = ((UserDetailsAndId)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getId();
|
||||
token = JwtUtil.createToken(id);
|
||||
} catch (AuthenticationException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import java.util.Collection;
|
|||
* @date 2022/9/28
|
||||
* */
|
||||
|
||||
public class EntUserDetails extends User {
|
||||
public class UserDetailsAndId extends User {
|
||||
|
||||
|
||||
private String id;
|
||||
|
|
@ -25,7 +25,7 @@ public class EntUserDetails extends User {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public EntUserDetails(String username, String password, Collection<? extends GrantedAuthority> authorities, String id) {
|
||||
public UserDetailsAndId(String username, String password, Collection<? extends GrantedAuthority> authorities, String id) {
|
||||
super(username, password, authorities);
|
||||
setId(id);
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.rzyc.service;
|
||||
|
||||
import com.rzyc.config.EntUserDetails;
|
||||
|
||||
import com.rzyc.config.UserDetailsAndId;
|
||||
import com.rzyc.mapper.AuthorityKeyMapper;
|
||||
import com.rzyc.mapper.ent.EntUserMapper;
|
||||
import com.rzyc.model.AuthorityKey;
|
||||
|
|
@ -65,7 +66,7 @@ public class UserDetailsServiceImpl implements UserDetailsService {
|
|||
stringBuilder.append(s.getCategory() +":"+s.getAuthKey());
|
||||
authority.add(new SimpleGrantedAuthority(stringBuilder.toString()));
|
||||
}
|
||||
return new EntUserDetails(entUser.getName(), passwordEncoder.encode(entUser.getPasswd()), authority,entUser.getEntUserId());
|
||||
return new UserDetailsAndId(entUser.getName(), passwordEncoder.encode(entUser.getPasswd()), authority,entUser.getEntUserId());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ package com.rzyc.service;
|
|||
|
||||
|
||||
import com.common.utils.jwt.JwtUtil;
|
||||
import com.rzyc.config.EntUserDetails;
|
||||
|
||||
import com.rzyc.config.UserDetailsAndId;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
|
|
@ -52,7 +53,7 @@ public class UserLoginService {
|
|||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
//企业用户id
|
||||
String id = ((EntUserDetails)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getId();
|
||||
String id = ((UserDetailsAndId)SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getId();
|
||||
token = JwtUtil.createToken(id);
|
||||
} catch (AuthenticationException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user