updated code

This commit is contained in:
harish
2024-10-19 13:10:13 +05:30
174 changed files with 7882 additions and 1012 deletions

View File

@@ -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)