authorization

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: Apache-2.0 Imports: 3 Imported by: 7 modules, 18 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorization

type Authorization struct {
	RequiredScopes            []string                        `json:"requiredScopes"`
	UseIdToken                bool                            `json:"useIdToken,omitempty"`
	ProtectedResourceMetadata *meta.ProtectedResourceMetadata `json:"protectedResourceMetadata"`
}

Authorization defines per-resource aI do uthorization requirements.

type IdTokenSource

type IdTokenSource interface {
	IdToken(ctx context.Context, token *oauth2.Token, protectedResource *meta.ProtectedResourceMetadata) (*oauth2.Token, error)
}

type Policy added in v0.2.0

type Policy struct {
	// Global resource protection metadata (mutually exclusive with Tools/Resources)
	Global *Authorization `json:"global,omitempty"`
	// ExcludeURI skips middleware on matching paths
	ExcludeURI string `json:"excludeURI,omitempty"`
	// Per-tool authorization metadata
	Tools map[string]*Authorization `json:"tools,omitempty"`
	// Per-tenant authorization metadata (reserved for future use)
	Resources map[string]*Authorization `json:"resources,omitempty"`
}

func (*Policy) IsFineGrained added in v0.2.0

func (a *Policy) IsFineGrained() bool

IsFineGrained reports whether this config uses fine-grained (tool/resource) control.

type ProtectedResourceTokenSource

type ProtectedResourceTokenSource interface {
	ProtectedResourceToken(ctx context.Context, protectedResource *meta.ProtectedResourceMetadata, scope string) (*oauth2.Token, error)
}

type Token

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

Token carries authentication credentials.

type TokenKeyType

type TokenKeyType string

TokenKeyType is the type used for the context key of Token.

const TokenKey TokenKeyType = "TokenKey"

TokenKey is the context key under which Token is stored.

type WithMeta

type WithMeta struct {
	Name     string `json:"name"`
	AuthMeta struct {
		Authorization *Token `json:"authorization,omitempty"`
	} `json:"_meta,omitempty"`
}

WithMeta extracts authorization metadata from JSON-RPC params.

Jump to

Keyboard shortcuts

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