authorization

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 28 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

View Source
const BodyLimit = 64 * 1024
View Source
const Deadline = 15 * time.Minute

Variables

This section is empty.

Functions

func CallbackFields

func CallbackFields(input, redirect, expected string, allowCode bool) (map[string]string, error)

func Expand

func Expand(template string, fields map[string]string) (string, error)

func Granted

func Granted(status int, document any) error

Granted reads a token endpoint's answer: nil for an issued token, a permission fault when the provider definitely refused the grant, and an unavailable fault for every answer that leaves the grant's fate open.

func HTTPClient

func HTTPClient() *http.Client

func Prepare

func Prepare(ctx context.Context, endpoint protocol.PluginModelAuthEndpoint, fields map[string]string) (*http.Request, error)

func Response

func Response(ctx context.Context, client *http.Client, endpoint protocol.PluginModelAuthEndpoint, fields map[string]string, errorDocument bool) (int, any, error)

func ValidateGrant

func ValidateGrant(body []byte, authentication protocol.Authentication, now time.Time) error

func ValidateRedirect

func ValidateRedirect(value string, declaration protocol.PluginModelAuthCallback) error

func VerifyIdentity

func VerifyIdentity(ctx context.Context, client *http.Client, issuer, token, audience string, nonce *string, now func() time.Time) (map[string]any, error)

Types

type Input

type Input struct {
	Declaration  protocol.PluginModelAuthDeclaration
	Fields       map[string]string
	Redirect     string
	Callback     <-chan string
	Bundle       *plugins.ScriptBundle
	Previous     any
	HostID       string
	Registration *string
	Registered   func(context.Context, string) error
	Client       *http.Client
	Clock        clockwork.Clock
	Progress     func(protocol.ConversationLoginState) error
}

type Issued

type Issued struct {
	AccountLabel *string           `json:"account_label,omitempty"`
	Access       string            `json:"access"`
	IssuedAtMs   *uint64           `json:"issued_at_ms,omitempty"`
	Refresh      *string           `json:"refresh"`
	ExpiresAtMs  *uint64           `json:"expires_at_ms"`
	Extra        map[string]string `json:"extra"`
}

func ParseIssued

func ParseIssued(document any, mapping protocol.PluginModelAuthMapping, now uint64, previous *Issued) (Issued, error)

func (Issued) Fields

func (issued Issued) Fields() map[string]string

func (Issued) Headers

func (issued Issued) Headers(injections []protocol.PluginModelAuthInjection) (http.Header, error)

type Result

type Result struct {
	Document any
	Issued   *Issued
	Grant    json.RawMessage
}

func Run

func Run(ctx context.Context, input Input) (Result, error)

Jump to

Keyboard shortcuts

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