tokens

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service manages access tokens

func New

func New(db *database.Database) *Service

New creates a new tokens service

func (*Service) CreateToken

func (service *Service) CreateToken(userID uint, name string) (*models.AccessToken, error)

CreateToken generates an access token

func (*Service) GetUserByToken

func (service *Service) GetUserByToken(token string) (*models.User, error)

GetUserByToken returns the user associated with the given token

func (*Service) GetUserTokens

func (service *Service) GetUserTokens(userID uint) ([]*models.AccessToken, error)

GetUserTokens returns all access tokens associated with a user

func (*Service) RemoveToken

func (service *Service) RemoveToken(id uint, userID uint) error

RemoveToken removes an access token

Jump to

Keyboard shortcuts

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