updated code
This commit is contained in:
@@ -82,10 +82,11 @@ public class TokenProvider {
|
||||
log.info("JWT Secret Key initialized.");
|
||||
}
|
||||
|
||||
public String createToken(Authentication authentication, Boolean rememberMe, UserEntity user) {
|
||||
String authorities = authentication.getAuthorities().stream()
|
||||
.map(GrantedAuthority::getAuthority)
|
||||
.collect(Collectors.joining(","));
|
||||
public String createToken(Boolean rememberMe, UserEntity user) {
|
||||
// String authorities = authentication.getAuthorities().stream()
|
||||
// .map(GrantedAuthority::getAuthority)
|
||||
// .collect(Collectors.joining(","));
|
||||
String authorities = user.getRoleEntity().getRoleType();
|
||||
Long now;
|
||||
Date validity;
|
||||
|
||||
@@ -99,10 +100,14 @@ public class TokenProvider {
|
||||
log.info("Creating token with standard validity of {} seconds.", this.tokenValidityInSeconds);
|
||||
}
|
||||
|
||||
String payload = authentication.getName();
|
||||
String payload = user.getEmail();
|
||||
if(user != null) {
|
||||
payload += ":"+user.getId();
|
||||
}
|
||||
|
||||
if(user != null) {
|
||||
payload += ":"+user.getHub().getId();
|
||||
}
|
||||
|
||||
String token = Jwts.builder()
|
||||
.setSubject(payload)
|
||||
|
||||
Reference in New Issue
Block a user