This commit is contained in:
Zuev committed 2026-10-02 04:07:56 +03:00
1 parent 97bf3cc50a
commit fc5801d683
42 files changed
+1201 -305

No files matched your search

@@ -85,7 +85,11 @@ public class JwtTokenService {
Long userId = asLong(jwt.getClaim("userId")).orElseGet(() -> Long.valueOf(jwt.getSubject()));
String username = jwt.getClaimAsString("username");
Role role = Role.valueOf(jwt.getClaimAsString("role"));
String roleClaim = jwt.getClaimAsString("role");
if (userId <= 0 || username == null || username.isBlank() || roleClaim == null) {
return Optional.empty();
}
Role role = Role.valueOf(roleClaim);
Long departmentId = asLong(jwt.getClaim("departmentId")).orElse(null);
return Optional.of(new AuthenticatedUser(userId, username, role, departmentId));