Documentation
¶
Overview ¶
Package identity provides shared types for edge-injected user identity. In SaaS mode, the Cloudflare Edge Router (formerly Kong Gateway) validates the incoming JWT and injects X-User-ID, X-Org-ID, X-User-Email, and X-User-Roles headers. This package makes those values available throughout the request lifecycle via context.
Use edgeauth.Middleware (CF Edge Router) or kong.Middleware (Kong) to populate the identity into context before calling FromContext().
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Identity ¶
type Identity struct {
UserID string `json:"user_id,omitempty"`
OrgID string `json:"org_id,omitempty"`
Email string `json:"email,omitempty"`
Tier string `json:"tier,omitempty"`
Roles []string `json:"roles,omitempty"`
}
Identity holds the user identity injected by the Cloudflare Edge Router (formerly Kong Gateway) after Auth0 JWT validation.
func FromContext ¶
FromContext retrieves the Identity from context. Returns nil if not present.
func FromHeaders ¶
FromHeaders extracts an Identity from HTTP headers.
func (*Identity) IsAuthenticated ¶
IsAuthenticated returns true if at least a UserID is present.