jwt

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MissingToken           = "missing token"
	InvalidKid             = "invalid jwt kid"
	InvalidSignature       = "invalid jwt signature"
	MissingKid             = "missing jwt kid"
	MissingCapabilities    = "missing jwt capabilities"
	NoMatchingCapabilities = "no matching jwt capabilities"
	MissingClientId        = "missing jwt client id"
	MissingTenantId        = "missing tenant id"
	UnauthorizedClientId   = "unauthorized jwt client id"
	UnauthorizedPartnerId  = "unauthorized jwt partner id"
	NoAllowedPartners      = "no allowed partners"
	InvalidSATFormat       = "invalid sat format"
	AllowedResources       = "allowedResources"
	AllowedPartners        = "allowedPartners"
	Capabilities           = "capabilities"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultJWTConsumer

type DefaultJWTConsumer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*DefaultJWTConsumer) VerifyToken

func (sc *DefaultJWTConsumer) VerifyToken(ctx context.Context, token string, api string, method string, tid *tenant.Id) ([]string, string, error)

VerifyToken validates a give token for an optional list of clientIds / "subjects" (use empty array if any client id ok) and for a given domain, component, api and method (api and method are encoded in the claim)

type JWTAuthError

type JWTAuthError struct {
	Wrapped error
}

func (*JWTAuthError) Error

func (e *JWTAuthError) Error() string

type JWTConsumer

type JWTConsumer interface {
	VerifyToken(ctx context.Context, token string, api string, method string, tid *tenant.Id) ([]string, string, error)
}

func NewJWTConsumer

func NewJWTConsumer(publicKeyEndpoint string, verifier Verifier, requireBearerToken bool, domain string, component string, adminClientIds []string, capabilityPrefixes []string, tenantStorer tenant.TenantStorer) (JWTConsumer, error)

type UnauthorizedError

type UnauthorizedError struct {
	Msg string
}

401 errors

func (*UnauthorizedError) Error

func (nfe *UnauthorizedError) Error() string

type Verifier

type Verifier func(path, method, scope string) bool

Jump to

Keyboard shortcuts

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