auth

package
v0.0.0-...-6dfde0d Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2017 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAppToken      = errors.New("No X-APP-TOKEN was found. This app is not authorized to use Partisan API")
	ErrAppTokenRevoked = errors.New("This App Token has been revoked.")
	ErrNoToken         = errors.New("No X-AUTH-TOKEN header was found")
)
View Source
var ErrNoUser = errors.New("User ID not set")

ErrNoUser signifies that the user couldn't be found in the context

Functions

func AppToken

func AppToken() gin.HandlerFunc

AppToken is middleware to make sure only Partisan approved products are accessing the API

func Auth

func Auth() gin.HandlerFunc

Auth is the authentication middleware

func CurrentUser

func CurrentUser(c *gin.Context) (u users.User, err error)

CurrentUser gets the current user from the session

func Login

func Login(user *users.User, deviceToken string, c *gin.Context) (string, error)

Login a user

func Logout

func Logout(u *users.User, c *gin.Context)

Logout a user

Types

This section is empty.

Jump to

Keyboard shortcuts

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