authorizeerr

package
v0.233.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package authorizeerr keeps the in-memory rules that make /authorize fail on purpose: a rule with an optional match on the /authorize query returns an OAuth error to the redirect_uri instead of logging the user in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(r Rule) error

Validate rejects rules that cannot be put in a redirect Location safely. Both fields are limited to the printable ASCII OAuth permits in error values (RFC 6749 section 4.1.2.1): no quote, backslash, control or non-ASCII characters.

Types

type Rule

type Rule struct {
	ID               string            `json:"id"`
	Match            map[string]string `json:"match,omitempty"`
	Error            string            `json:"error"`
	ErrorDescription string            `json:"error_description,omitempty"`
}

Rule is one registered authorize failure.

type Store

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

Store is a mutex-guarded rule registry.

func NewStore

func NewStore() *Store

NewStore returns an empty Store.

func (*Store) Add

func (s *Store) Add(r Rule) Rule

Add stores a copy of r under a fresh ID (any inbound ID is overwritten) and returns the stored copy.

func (*Store) Clear

func (s *Store) Clear()

Clear removes every rule.

func (*Store) Delete

func (s *Store) Delete(id string) bool

Delete removes the rule with the given ID and reports whether it existed.

func (*Store) Find

func (s *Store) Find(q url.Values) *Rule

Find returns a copy of the newest rule whose Match is a subset of q, or nil when none applies.

func (*Store) List

func (s *Store) List() []Rule

List returns copies of every rule in registration order.

Jump to

Keyboard shortcuts

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