authentication

package
v0.0.0-...-14d7d22 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticatedUser

func AuthenticatedUser(ctx context.Context) *model.User

AuthenticatedUser returns the authenticated user in the context or nil if no user is authenticated. Modifying the returned user does not modify the user in the context.

Types

type Authenticator

type Authenticator struct {
	UserRepository persistence.UserRepository
}

Authenticator authenticates users. If used as a middleware it requires that the request is authenticated.

func (*Authenticator) HandlerFunc

func (a *Authenticator) HandlerFunc(next http.HandlerFunc) http.HandlerFunc

HandlerFunc returns a handler func that authenticates the user making the request and add that user to the context. Using this middleware enables the usage of AuthenticatedUser to retrieve the user that made the request.

Jump to

Keyboard shortcuts

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