fix: resolve 25 SonarQube code smells across 21 files
Remove unused fields (log, rbacService, roleRepository, jwt), unused variables (agentTps, routeKeys, updated), unused imports (HttpHeaders, JdbcTemplate). Rename restricted identifier 'record' to 'auditRecord'/'event'. Return empty collections instead of null. Replace .collect(Collectors.toList()) with .toList(). Simplify conditional return in BootstrapTokenValidator. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,20 +31,12 @@ public class BootstrapTokenValidator {
|
||||
|
||||
byte[] providedBytes = provided.getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
// Check current token
|
||||
// Check current token, then previous token (rotation support)
|
||||
String currentToken = properties.getBootstrapToken();
|
||||
if (currentToken != null
|
||||
&& MessageDigest.isEqual(providedBytes, currentToken.getBytes(StandardCharsets.UTF_8))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check previous token (rotation support)
|
||||
String previousToken = properties.getBootstrapTokenPrevious();
|
||||
if (previousToken != null
|
||||
&& MessageDigest.isEqual(providedBytes, previousToken.getBytes(StandardCharsets.UTF_8))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return (currentToken != null
|
||||
&& MessageDigest.isEqual(providedBytes, currentToken.getBytes(StandardCharsets.UTF_8)))
|
||||
|| (previousToken != null
|
||||
&& MessageDigest.isEqual(providedBytes, previousToken.getBytes(StandardCharsets.UTF_8)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user