refactor: remove getUserRoles from LogtoManagementClient — roles come from JWT
This commit is contained in:
@@ -75,29 +75,6 @@ public class LogtoManagementClient {
|
|||||||
.toBodilessEntity();
|
.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) {
|
public List<Map<String, String>> getUserOrganizations(String userId) {
|
||||||
if (!isAvailable()) return List.of();
|
if (!isAvailable()) return List.of();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user