auth

package
v0.0.33-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear()

Clear is provided to be used in tests It unregiseters all Auth handlers. Use in production at your own risk...

func Register

func Register(name string, handlers ...Auth)

Register takes a list and a list of Auth(er?) instances and registers them as possible things that can be applied in the auth middleware to authenticate the viewer Since these functions are registered ad-hoc, if there's a strict dependency between functions, they should be passed in with one Register function

Types

type Auth

type Auth interface {
	// Viewer gathers information from the request (and optionally writes to the response)
	// and returns the authenticated viewer for this request. If cannot authenticate the viewer,
	// this method should return nil.
	// The framework will eventually put a LoggedOutViewer: viewer.LoggedOutViewer()
	// if no ViewerContext is returned by any Auth Handler
	AuthViewer(http.ResponseWriter, *http.Request) viewer.ViewerContext
}

Auth interface should be implemented to get information from the request (such as header or cookie) to authenticate the user.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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