Documentation
¶
Overview ¶
Package admin holds shared helpers for the /admin/v1 HTTP surface: RFC 7807 problem+json marshalling and keyset cursor encoding.
Index ¶
Constants ¶
const ( CodeForbidden = "rbac.forbidden" CodeOrgMismatch = "rbac.org_mismatch" CodeNoActiveOrg = "rbac.no_active_org" CodeRoleInUse = "rbac.role_in_use" CodeUnknownPermission = "rbac.unknown_permission" CodeBadCursor = "pagination.bad_cursor" CodeUserNotInOrg = "admin.user_not_in_org" CodeValidationInvalid = "validation.invalid" CodeNotFound = "admin.not_found" CodeInternal = "admin.internal" CodeUnsupportedAction = "admin.unsupported_action" )
Reserved problem codes. Listed here so the admin handlers and the middleware both pull from the same source of truth.
const ProblemTypeBase = "https://theauth.dev/problems/"
ProblemTypeBase is the URI prefix for problem types per RFC 7807. Each problem code is appended to form the canonical type URI. Consumers may host their own equivalent page; the URI is informational only.
Variables ¶
This section is empty.
Functions ¶
func DecodeCursor ¶
DecodeCursor reverses EncodeCursor. Returns an error on any malformed input; handlers map the error to a 400 problem+json with code "pagination.bad_cursor".
func EncodeCursor ¶
EncodeCursor returns a URL-safe base64 string of "<unix_micros>:<ulid>". Decoding is symmetric and tolerant of any input that round-trips back to a parsable (int64, ULID) pair; everything else returns an error.
Types ¶
type Problem ¶
type Problem struct {
Type string `json:"type"`
Title string `json:"title"`
Status int `json:"status"`
Detail string `json:"detail,omitempty"`
Instance string `json:"instance,omitempty"`
Code string `json:"code"`
}
Problem is the RFC 7807 application/problem+json document shape, plus the "code" extension this library uses for machine-readable error matching.