service

package
v0.0.0-...-dfdf43d Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSession

func NewSession(w http.ResponseWriter, r *http.Request)

NewSession responds to authentication request with jwt token or appropriate error

func NewSessionMiddleware

func NewSessionMiddleware(next http.Handler) http.Handler

NewSessionMiddleware middleware to authenticate a user from the request parameters

func NewUser

func NewUser(w http.ResponseWriter, r *http.Request)

NewUser renders the response to the product update request.

func NewUserMiddleware

func NewUserMiddleware(next http.Handler) http.Handler

NewUserMiddleware middleware to add a new user to the repo from the request parameters

Types

type Claims

type Claims struct {
	// Subject (globally unique user id) of token
	Sub string

	// Subjects email address
	Email string

	// Not valid before
	Nbf int64

	// Expire at
	Exp int64

	// Issued at
	Iat int64
}

func NewClaims

func NewClaims(id, email string) Claims

type TokenFactory

type TokenFactory interface {
	// NewToken returns a new token string with the given claims
	NewToken(claims Claims) (string, error)
}

TokenFactory provides methods for creating authentication tokens.

func NewTokenFactory

func NewTokenFactory(config common.Configuration) (TokenFactory, error)

NewTokenFactory constructs a token factory using the given configuration.

Jump to

Keyboard shortcuts

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