auth

package
v0.0.0-...-1990afc Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator struct {
	Username string
	Password string
	Token    string
}

Authenticator exposes a function for authenticating requests.

func (Authenticator) Authenticate

func (a Authenticator) Authenticate(ctx context.Context) (newCtx context.Context, err error)

Authenticate checks that a token exists and is valid. It stores the user metadata in the returned context and removes the token from the context.

type UserMetadata

type UserMetadata struct {
	ID string
}

UserMetadata contains metadata about a user.

func GetUserMetadata

func GetUserMetadata(ctx context.Context) (*UserMetadata, bool)

GetUserMetadata can be used to extract user metadata stored in a context.

Jump to

Keyboard shortcuts

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