authinterface

package
v0.0.0-...-b5a46b0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2020 License: MIT Imports: 4 Imported by: 0

README

authinterface: a library providing an interface for libraries providing and/or checking auth

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DenyWith

func DenyWith(info AuthFailureInfo) error

func ErrorWith

func ErrorWith(err error, info AuthFailureInfo) error

Types

type AnyOfGatekeepers

type AnyOfGatekeepers []Gatekeeper

func (AnyOfGatekeepers) CheckAuth

func (a AnyOfGatekeepers) CheckAuth(r *http.Request) (*AuthSuccessInfo, error)

func (AnyOfGatekeepers) DemandAuth

func (a AnyOfGatekeepers) DemandAuth(w http.ResponseWriter) error

func (AnyOfGatekeepers) GatekeeperDescription

func (a AnyOfGatekeepers) GatekeeperDescription() string

type AttemptInfo

type AttemptInfo struct {
	GatekeeperID string `json:"gatekeeper_id"`
	Username     string `json:"username,omitempty"`
	Realm        string `json:"realm,omitempty"`
	Attempted    bool   `json:"attempted"`
}

type AuthFailureInfo

type AuthFailureInfo struct {
	Attempt AttemptInfo `json:"attempt"`
}

type AuthProvider

type AuthProvider interface {
	MakeAuthHeaders(ctx RequestContext) (map[string]string, error)
}

type AuthSuccessInfo

type AuthSuccessInfo struct {
	Attempt AttemptInfo `json:"attempt"`
}

type ErrorWithFailureInfo

type ErrorWithFailureInfo interface {
	AuthFailureInfo() AuthFailureInfo
}

type Gatekeeper

type Gatekeeper interface {
	CheckAuth(r *http.Request) (*AuthSuccessInfo, error)
	DemandAuth(w http.ResponseWriter) error
	GatekeeperDescription() string
}
var AllowAll Gatekeeper = allowAll{}
var DenyAll Gatekeeper = denyAll{}

type RequestContext

type RequestContext struct {
	RecipientHost string
	RequestTime   time.Time
}

Jump to

Keyboard shortcuts

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