auth

package
v0.0.0-...-7e476e1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MagicCodeCache = initCache(300) //5 minute expiry

MagicCodeCache is the cache for storing email/temp pw combinations for passwordless authorisation

Functions

func Activate

func Activate() error

Activate is the main package activation function

func Authorizator

func Authorizator(next http.Handler) http.Handler

This is the first level of authorisation: The JWT contains the userId. We look this up in the users table in the database and if found attach the specified role. If nothing is found, we default to anon Beyond this, we do not know anything about database privelages - this is handled further down the line

func GetUserToken

func GetUserToken(userID string) (string, error)

GetUserToken returns a JWT string encoded with a user id

func RequestMagicCode

func RequestMagicCode(email string) error

RequestMagicCode generates a magic code, stores it in the cache against the user's email and sends it to them by email

Types

This section is empty.

Jump to

Keyboard shortcuts

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