oauth

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const AuthorizationPath = "/oauth/authorize"
View Source
const AuthorizationServerMetadataPath = "/.well-known/oauth-authorization-server"
View Source
const DynamicClientRegistrationPath = "/oauth/register"
View Source
const OIDCMetadataPath = "/.well-known/openid-configuration"
View Source
const ProtectedResourcePath = "/.well-known/oauth-protected-resource/"

Variables

This section is empty.

Functions

func GetMedatata

func GetMedatata(server string) (map[string]any, error)

func GetOriginalURL added in v0.3.0

func GetOriginalURL(ctx context.Context) *url.URL

func GetRawToken

func GetRawToken(ctx context.Context) string

func GetToken

func GetToken(ctx context.Context) jwt.Token

func NewAuthorizationHandler

func NewAuthorizationHandler(config *config.Config, meta map[string]any) (http.Handler, error)

func NewAuthorizationServerMetadataHandler

func NewAuthorizationServerMetadataHandler(config *config.Config) http.Handler

func NewDynamicClientRegistrationHandler

func NewDynamicClientRegistrationHandler(config *config.Config, meta map[string]any) (http.Handler, error)

func NewProtectedResourceHandler

func NewProtectedResourceHandler(config *config.Config) http.Handler

NewWellKnownHandler implement the OAuth 2.0 Protected Resource Metadata (RFC9728) specification to indicate the locations of authorization servers.

Should be used to create a handler for the /.well-known/oauth-protected-resource endpoint.

func RewriteSetOriginalURL added in v0.3.0

func RewriteSetOriginalURL(r *httputil.ProxyRequest)

func TokenContext

func TokenContext(parent context.Context, token jwt.Token, rawToken string) context.Context

func WithOriginalURL added in v0.3.0

func WithOriginalURL(ctx context.Context, url *url.URL) context.Context

Types

type ClientInformation

type ClientInformation struct {
	ClientID              string   `json:"client_id"`
	ClientSecret          string   `json:"client_secret,omitempty"`
	ClientSecretExpiresAt int64    `json:"client_secret_expires_at,omitempty"`
	ClientName            string   `json:"client_name,omitempty"`
	RedirectURIs          []string `json:"redirect_uris"`
	LogoURI               string   `json:"logo_uri,omitempty"`
	Scope                 string   `json:"scope,omitempty"`
}

type Manager

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

func NewManager

func NewManager(ctx context.Context, config *config.Config) (*Manager, error)

func (*Manager) Handler

func (mgr *Manager) Handler(next http.Handler) http.Handler

func (*Manager) Register

func (mgr *Manager) Register(mux *http.ServeMux) error

func (*Manager) UpdateWWWAuthenticateHeader added in v0.3.0

func (mgr *Manager) UpdateWWWAuthenticateHeader(resp *http.Response) error

type ProtectedResourceMetadata

type ProtectedResourceMetadata struct {
	Resource             string         `json:"resource"`
	AuthorizationServers []string       `json:"authorization_servers"`
	ExtraFields          map[string]any `json:"-"`
}

Jump to

Keyboard shortcuts

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