refactor: remove getUserRoles from LogtoManagementClient — roles come from JWT

This commit is contained in:
hsiegeln
2026-04-05 12:40:58 +02:00
parent bd2a6a601b
commit 5f43394b00

View File

@@ -75,29 +75,6 @@ public class LogtoManagementClient {
.toBodilessEntity();
}
public List<String> getUserRoles(String userId) {
if (!isAvailable()) return List.of();
try {
var response = restClient.get()
.uri(config.getLogtoEndpoint() + "/api/users/" + userId + "/roles")
.header("Authorization", "Bearer " + getAccessToken())
.retrieve()
.body(JsonNode.class);
List<String> roles = new ArrayList<>();
if (response != null && response.isArray()) {
for (var node : response) {
roles.add(node.get("name").asText());
}
}
return roles;
} catch (Exception e) {
log.warn("Failed to get user roles for {}: {}", userId, e.getMessage());
return List.of();
}
}
public List<Map<String, String>> getUserOrganizations(String userId) {
if (!isAvailable()) return List.of();