auth

package
v0.0.0-...-5404be9 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	DB           storage.DB
	Queries      goyesql.Queries
	TokenStorage *token.Storage
}

Handler holds objects to be reused between requests, like a database connection

func NewHandler

func NewHandler(cache storage.Cache, db storage.DB) (*Handler, error)

NewHandler creates a new Handler

func (*Handler) AuthRequired

func (h *Handler) AuthRequired(c *gin.Context)

AuthRequired ensures that only authenticated requests will reach next handlers

func (*Handler) Login

func (h *Handler) Login(c *gin.Context)

Login generates a new session

func (*Handler) Logout

func (h *Handler) Logout(c *gin.Context)

Logout logs out a user removing the token used for that

func (*Handler) Signup

func (h *Handler) Signup(c *gin.Context)

Signup allows a user to sign up

func (*Handler) Token

func (h *Handler) Token(c *gin.Context)

Token creates a new Auth token

func (*Handler) Tokens

func (h *Handler) Tokens(c *gin.Context)

Tokens returns the list of tokens for the current user

func (*Handler) User

func (h *Handler) User(c *gin.Context)

User returns information about the current user

Jump to

Keyboard shortcuts

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