dcr

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 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

View Source
var SupportedGrantTypes = []string{"authorization_code", "refresh_token"}

SupportedGrantTypes is the complete set a DYNAMICALLY REGISTERED client may hold. It is deliberately narrower than the authorization server's own grant_types_supported: those are available to statically configured clients, which an operator authored and can be held accountable for, whereas a DCR client is anonymous, credential-less and freely re-mintable.

Keep this a redirect-based pair. Adding a grant that authenticates without a redirect (password, client_credentials) hands an unauthenticated caller a working credential-testing client. See GHSA-hm9g-w2cw-j7gg.

Functions

func FilterGrantTypes added in v0.22.1

func FilterGrantTypes(grants []string) []string

FilterGrantTypes applies the DCR grant policy to a client's grants. With none given it returns SupportedGrantTypes (the registration default); otherwise it keeps only the supported ones, preserving order and dropping duplicates. An empty result means nothing given was supported, which every caller must treat as a refusal: an empty grant list reads as "every grant" at the token endpoint.

It runs both when a client registers and when a stored client is read back, so a record persisted before registration filtered grants (pre-v0.5.1) is held to the same policy.

Types

type Client

type Client struct {
	ClientID                string   `json:"client_id"`
	RedirectURIs            []string `json:"redirect_uris"`
	GrantTypes              []string `json:"grant_types,omitempty"`
	ResponseTypes           []string `json:"response_types,omitempty"`
	Scope                   string   `json:"scope,omitempty"`
	ClientName              string   `json:"client_name,omitempty"`
	TokenEndpointAuthMethod string   `json:"token_endpoint_auth_method"`
	CreatedAt               int64    `json:"created_at"`
}

Client is a dynamically-registered (RFC 7591) OAuth client record.

type Store

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

func NewStore

func NewStore(cm cache.CacheManager, host string, ttl time.Duration, maxClients int32) *Store

func (*Store) Get

func (s *Store) Get(ctx context.Context, clientID string) (Client, bool, error)

func (*Store) Register

func (s *Store) Register(ctx context.Context, c Client) (Client, error)

Jump to

Keyboard shortcuts

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