ticket

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasCode

func HasCode(err error, code ErrorCode) bool

Types

type AuthorizationError

type AuthorizationError struct {
	Code ErrorCode
}

func (*AuthorizationError) Error

func (err *AuthorizationError) Error() string

type Authorizer

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

func NewAuthorizer

func NewAuthorizer(runtimeState state.State, store *state.Store, now time.Time) (*Authorizer, error)

func (*Authorizer) ClaimVerified

func (authorizer *Authorizer) ClaimVerified(claims Claims, now time.Time) error

func (*Authorizer) IsClaimed

func (authorizer *Authorizer) IsClaimed(jti string, now time.Time) (bool, error)

func (*Authorizer) Verify

func (authorizer *Authorizer) Verify(compactJWS string, binding Binding, now time.Time) (Claims, error)

func (*Authorizer) VerifyAndClaim

func (authorizer *Authorizer) VerifyAndClaim(
	compactJWS string,
	binding Binding,
	now time.Time,
) (Claims, error)

type Binding

type Binding struct {
	OfferingID    string
	Protocol      string
	RequiredScope string
}

type Claims

type Claims struct {
	Issuer                   string   `json:"iss"`
	Audience                 string   `json:"aud"`
	JTI                      string   `json:"jti"`
	IssuedAt                 int64    `json:"iat"`
	NotBefore                int64    `json:"nbf"`
	ExpiresAt                int64    `json:"exp"`
	SessionID                string   `json:"session_id"`
	ConnectionID             string   `json:"connection_id"`
	Generation               int64    `json:"generation"`
	OfferingID               string   `json:"offering_id"`
	GatewayID                string   `json:"gateway_id"`
	Mode                     string   `json:"mode"`
	Protocol                 string   `json:"protocol"`
	ConnectBefore            int64    `json:"connect_before"`
	HardStopAt               int64    `json:"hard_stop_at"`
	SessionConnectedMSBefore int64    `json:"session_connected_ms_before"`
	MaxSessionConnectedMS    int64    `json:"max_session_connected_ms"`
	Scope                    []string `json:"scope"`
	Nonce                    string   `json:"nonce"`
}

type ErrorCode

type ErrorCode string
const (
	CodeInvalid          ErrorCode = "invalid_ticket"
	CodeNotYetValid      ErrorCode = "ticket_not_yet_valid"
	CodeExpired          ErrorCode = "ticket_expired"
	CodeReplay           ErrorCode = "ticket_replayed"
	CodeStateUnavailable ErrorCode = "ticket_state_unavailable"
)

type ProtectedHeader

type ProtectedHeader struct {
	Algorithm string `json:"alg"`
	KeyID     string `json:"kid"`
	Type      string `json:"typ"`
}

type Verifier

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

func NewVerifier

func NewVerifier(runtimeState state.State, now time.Time) (*Verifier, error)

func (*Verifier) Verify

func (verifier *Verifier) Verify(compactJWS string, binding Binding, now time.Time) (Claims, error)

Jump to

Keyboard shortcuts

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