database

package
v0.0.0-...-aa65b62 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUser

func AddUser(mongo *mongo.Client, login, password string) (string, error)

AddUser adds UserDao document into users collection

func CreateClient

func CreateClient(connectionString string) (*mongo.Client, error)

CreateClient opens mongodb connection and returns client

func DefaultClient

func DefaultClient() *mongo.Client

DefaultClient returns default mongo client

func FindUserByAuthorizationCode

func FindUserByAuthorizationCode(mongo *mongo.Client, code string) (*models.User, error)

FindUserByAuthorizationCode returns user with given code

func FindUserByLogin

func FindUserByLogin(mongo *mongo.Client, login string) (*models.User, error)

FindUserByLogin returns user with given login

func FindUserByRefreshToken

func FindUserByRefreshToken(mongo *mongo.Client, refreshToken string) (*models.User, error)

FindUserByRefreshToken returns user with given refresh token

func RevokeRefreshToken

func RevokeRefreshToken(mongo *mongo.Client, login string) error

RevokeRefreshToken revokes refresh and access token for login

func UpdateAccessToken

func UpdateAccessToken(mongo *mongo.Client, login, accessToken string, validUntil time.Time) error

UpdateAccessToken updates access token for login

func UpdateAuthorizationCode

func UpdateAuthorizationCode(mongo *mongo.Client, login, code string, codeValidUntil time.Time) error

UpdateAuthorizationCode updates authorization code for login

func UpdateRefreshToken

func UpdateRefreshToken(mongo *mongo.Client, login, refreshToken, accessToken string, refreshValidUntil, validUntil time.Time) error

UpdateRefreshToken updates refresh and access token for login

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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