29 lines
1.0 KiB
Java
29 lines
1.0 KiB
Java
package com.baiyue.overseassecurity.dto;
|
|
|
|
import jakarta.validation.constraints.Min;
|
|
import jakarta.validation.constraints.NotNull;
|
|
|
|
import java.time.Instant;
|
|
|
|
public final class OverseasSecurityDtos {
|
|
private OverseasSecurityDtos() { }
|
|
|
|
public record Acknowledgement(String eventId, String result, Instant receivedAt) { }
|
|
|
|
public record ValidationRequest(@NotNull @Min(1) Long userId,
|
|
@NotNull @Min(0) Long tenantId,
|
|
@NotNull @Min(0) Long tokenVersion,
|
|
@NotNull @Min(0) Long permissionVersion) { }
|
|
|
|
public record ValidationResponse(boolean valid, FailureReason failureReason) {
|
|
public static ValidationResponse accepted() { return new ValidationResponse(true, null); }
|
|
public static ValidationResponse rejected(FailureReason reason) { return new ValidationResponse(false, reason); }
|
|
}
|
|
|
|
public enum FailureReason {
|
|
USER_DISABLED,
|
|
TENANT_DISABLED,
|
|
PERMISSION_VERSION_STALE
|
|
}
|
|
}
|