auth

package
v0.0.0-...-ebb5aed Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, a *AuthContext) context.Context

Types

type AuthContext

type AuthContext struct {
	AuthMethod string
	UserName   string
}

func FromContext

func FromContext(ctx context.Context) (*AuthContext, bool)

type AuthProvider

type AuthProvider interface {
	// Returns HTTP middleware for performing authentication.
	Middleware() func(http.Handler) http.Handler
}

Abstracts the authentication backend for the server.

func NewFromURL

func NewFromURL(authURL string) (AuthProvider, error)

func NewHtpasswd

func NewHtpasswd(location string) (AuthProvider, error)

func NewIMAP

func NewIMAP(addr string, tls bool) AuthProvider

Initializes a new IMAP auth provider with the given connection string.

func NewNull

func NewNull() (AuthProvider, error)

func NewOAuth2

func NewOAuth2(endpoint, clientID, clientSecret string) (AuthProvider, error)

Initializes a new OAuth 2.0 auth provider with the given connection string.

func NewPAM

func NewPAM() (AuthProvider, error)

type IMAPProvider

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

func (*IMAPProvider) Middleware

func (prov *IMAPProvider) Middleware() func(http.Handler) http.Handler

type OAuth2Provider

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

func (*OAuth2Provider) Middleware

func (prov *OAuth2Provider) Middleware() func(http.Handler) http.Handler

Jump to

Keyboard shortcuts

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