jwt

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExpiryClaim = Claim[Expiry]{
				// contains filtered or unexported fields
	}
	// WorkspaceClaim is written by keycloak's MC_CUSTOMER script mapper, which strips the c: scope
	// prefix, so this carries the identifier rather than the scope. It is absent altogether where
	// the user holds no role on the workspace the token was asked for, which is NoWorkspace here.
	WorkspaceClaim = StringClaim[meshstack.Workspace]("MC_CUSTOMER")

	ScopeClaim = Claim[scope.Scopes]{
				// contains filtered or unexported fields
	}
	PreferredUsernameClaim = StringClaim[string]("preferred_username")
	EmailClaim             = StringClaim[string]("email")
	// ClientIdClaim is only on a token a client minted with its own credentials, such as an API key.
	ClientIdClaim = StringClaim[string]("client_id")
)

Functions

This section is empty.

Types

type Claim

type Claim[V any] struct {
	// contains filtered or unexported fields
}

func StringClaim

func StringClaim[V ~string](key string) Claim[V]

StringClaim reads a claim written as a JSON string, and is the zero value of V where the claim is absent or is not a string.

type Expiry

type Expiry struct {
	time.Time
}

func (Expiry) Expired

func (expiry Expiry) Expired(grace time.Duration) bool

type JWT

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

func (JWT) GetClaim

func (jwt JWT) GetClaim[V any](claim Claim[V]) V

func (JWT) MarshalText

func (jwt JWT) MarshalText() (text []byte, err error)

func (JWT) String

func (jwt JWT) String() string

func (*JWT) UnmarshalText

func (jwt *JWT) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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