pkg

package
v0.0.0-...-cfbf2a4 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationChecker

type AuthorizationChecker interface {
	CheckAuthorization(auth string) (bool, error)
}

AuthorizationChecker is an interface type that provides a way to check if the client used proper authorization

type IntrospectionAuthChecker

type IntrospectionAuthChecker struct {
	// contains filtered or unexported fields
}

IntrospectionAuthChecker is an AuthorizationChecker that uses the linked native introspection endpoint to send a dummy token introspection request with the same authorization

func NewIntrospectionAuthChecker

func NewIntrospectionAuthChecker(introspectionEndpoint string) IntrospectionAuthChecker

NewIntrospectionAuthChecker creates a new IntrospectionAuthChecker with the passed introspectionEndpoint

func (IntrospectionAuthChecker) CheckAuthorization

func (c IntrospectionAuthChecker) CheckAuthorization(auth string) (bool, error)

CheckAuthorization implements the AuthorizationChecker interface

type TIP

type TIP struct {
	// contains filtered or unexported fields
}

func NewTokenProxy

func NewTokenProxy(conf TIPConfig, authChecker AuthorizationChecker) *TIP

type TIPConfig

type TIPConfig struct {
	LinkedIssuer              linkedIssuerConf   `yaml:"linked_issuer"`
	RemoteIssuers             []remoteIssuerConf `yaml:"remote_issuers"`
	FallbackIssuerUnknown     remoteIssuerConf   `yaml:"fallback_issuer_unknown_token_issuer"`
	FallbackIssuerUnsupported remoteIssuerConf   `yaml:"fallback_issuer_unsupported_token_issuer"`
	Federation                federationConf     `yaml:"federation"`
}

type TIPError

type TIPError struct {
	ErrorCode        string `json:"error"`
	ErrorDescription string `json:"error_description,omitempty"`
	Status           int    `json:"-"`
}

func (TIPError) Error

func (e TIPError) Error() string

Error implements the error interface

type TokenIntrospectionRequest

type TokenIntrospectionRequest struct {
	Token         string `json:"token" form:"token" query:"token" url:"token"`
	TokenTypeHint string `json:"token_type_hint,omitempty" form:"token_type_hint,omitempty" query:"token,omitempty" url:"token,omitempty"`
	Authorization string `json:"-" form:"-" query:"-" url:"-"`
}

type TokenIntrospectionResponse

type TokenIntrospectionResponse struct {
	Active     bool                              `json:"active"`
	Scope      string                            `json:"scope,omitempty"`
	ClientID   string                            `json:"client_id,omitempty"`
	Username   string                            `json:"username,omitempty"`
	TokenType  string                            `json:"token_type,omitempty"`
	Expiration unixtime.UnixTime                 `json:"exp,omitempty"`
	IssuedAt   unixtime.UnixTime                 `json:"iat,omitempty"`
	NotBefore  unixtime.UnixTime                 `json:"nbf,omitempty"`
	Subject    string                            `json:"sub,omitempty"`
	Audience   oidfed.SliceOrSingleValue[string] `json:"aud,omitempty"`
	Issuer     string                            `json:"iss,omitempty"`
	JTI        string                            `json:"jti,omitempty"`
	Extra      map[string]any                    `json:"-"`
}

func (TokenIntrospectionResponse) MarshalJSON

func (r TokenIntrospectionResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. It also marshals extra fields.

func (*TokenIntrospectionResponse) UnmarshalJSON

func (r *TokenIntrospectionResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. It also unmarshalls additional fields into the Extra claim.

Jump to

Keyboard shortcuts

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