auth

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizeWrapper

type AuthorizeWrapper[User IsNillable, Account IsNillable] struct {
	// contains filtered or unexported fields
}

AuthorizeWrapper combines multiple authorizers and executes them in order.

func NewAuthorizeWrapper

func NewAuthorizeWrapper[User IsNillable, Account IsNillable](authorizers ...Authorizer[User, Account]) *AuthorizeWrapper[User, Account]

NewAuthorizeWrapper creates a wrapper from the provided non-nil authorizers.

func (*AuthorizeWrapper[User, Account]) Authorize

func (a *AuthorizeWrapper[User, Account]) Authorize(w http.ResponseWriter, r *http.Request) (string, User, Account, error)

Authorize runs each authorizer until one returns a non-nil user or account. If any authorizer returns an error, authorization stops and the error is returned.

type Authorizer

type Authorizer[User IsNillable, Account IsNillable] interface {
	// AuthorizerCode returns a unique identifier for the authorizer.
	AuthorizerCode() string
	// Authorize validates request credentials and returns token, user, account, and error.
	Authorize(w http.ResponseWriter, r *http.Request) (string, User, Account, error)
}

Authorizer defines a single authorization strategy.

type IsNillable added in v0.4.0

type IsNillable interface {
	IsNil() bool
}

IsNillable describes a type that can report whether it is nil/empty.

Directories

Path Synopsis
Package elogin provides auth middle procedures for remote authentication including oauth2 and other protocols, and specific providers like google, facebook, etc.
Package elogin provides auth middle procedures for remote authentication including oauth2 and other protocols, and specific providers like google, facebook, etc.
serverprovider/mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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