fix #492: add token context selection
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.cloudhandson.vpdbackoffice.domain.mcp;
|
||||
|
||||
public record McpReasoningCommand(
|
||||
Long tokenKeyId,
|
||||
long objectId,
|
||||
String bearerToken,
|
||||
int limit,
|
||||
|
||||
@@ -6,6 +6,7 @@ import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
|
||||
public record ProbeCommand(
|
||||
Long tokenKeyId,
|
||||
@Positive long objectId,
|
||||
@NotBlank String bearerToken,
|
||||
@Min(1) @Max(500) int limit
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.cloudhandson.vpdbackoffice.domain.token;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public record TokenContextView(
|
||||
long keyId,
|
||||
long userId,
|
||||
String username,
|
||||
String keyPrefix,
|
||||
LocalDateTime expiresAt,
|
||||
LocalDateTime revokedAt,
|
||||
String description,
|
||||
boolean active,
|
||||
List<String> directRoles,
|
||||
List<String> groups,
|
||||
List<String> inheritedRoles
|
||||
) {
|
||||
|
||||
public String statusLabel() {
|
||||
if (active) {
|
||||
return "ACTIVE";
|
||||
}
|
||||
return revokedAt == null ? "EXPIRED" : "REVOKED";
|
||||
}
|
||||
|
||||
public String maskedToken() {
|
||||
if (keyPrefix == null || keyPrefix.isBlank()) {
|
||||
return "****";
|
||||
}
|
||||
return keyPrefix + "****";
|
||||
}
|
||||
|
||||
public String displayLabel() {
|
||||
return "#" + keyId + " / " + username + " / " + statusLabel();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user