introspect

package
v1.5.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleIntrospect

func HandleIntrospect(w http.ResponseWriter, r *http.Request)

HandleIntrospect godoc @Summary Introspect a token @Description Validates and retrieves metadata about a token @Tags introspect @Accept json @Produce json @Param token body IntrospectRequest true "Token introspection payload" @Success 200 {object} IntrospectResponse @Failure 400 {object} model.ApiError @Failure 401 {object} model.ApiError @Failure 429 {object} model.ApiError @Failure 500 {object} model.ApiError @Router /oauth2/introspect [post]

func IntrospectToken

func IntrospectToken(tokenID string) (*token.Token, error)

func ValidateTokenIntrospectRequest

func ValidateTokenIntrospectRequest(input IntrospectRequest) error

Types

type IntrospectRequest

type IntrospectRequest struct {
	Token string `json:"token"`
}

type IntrospectResponse

type IntrospectResponse struct {
	Active           bool   `json:"active"`               // Whether the token is valid (true or false).
	Scope            string `json:"scope,omitempty"`      // Space-delimited list of scopes associated with the token.
	ClientID         string `json:"client_id,omitempty"`  // Client ID for which the token was issued.
	Username         string `json:"username,omitempty"`   // The username of the authenticated user.
	TokenType        string `json:"token_type,omitempty"` // The type of the token (usually "bearer").
	Exp              int64  `json:"exp,omitempty"`        // Expiration time (Unix timestamp).
	Iat              int64  `json:"iat,omitempty"`        // Issued-at time (Unix timestamp).
	Sub              string `json:"sub,omitempty"`        // The subject of the token (typically the user ID).
	Aud              string `json:"aud,omitempty"`        // Intended audience for the token (e.g., the API).
	Nbf              int64  `json:"nbf,omitempty"`        // Not-before time (Unix timestamp).
	Jti              string `json:"jti,omitempty"`        // Unique identifier for the token.
	Error            string `json:"error,omitempty"`
	ErrorDescription string `json:"error_description,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL