auth

package
v0.0.0-...-97fc41f Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2020 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(hash, password string) bool

Compare takes a password and hash compares and returns true for match

func CreateAccessToken

func CreateAccessToken(dbClient db.Database, authCode *models.AuthCode) (*models.AccessToken, error)

CreateAccessToken creates and saves an access token with a year of validity

func CreateAuthorizationCode

func CreateAuthorizationCode(dbClient db.Database, userID *protos.ObjectID, clientID string) (*models.AuthCode, error)

CreateAuthorizationCode creates and saves an authorization code with the client & user id

func CreateKey

func CreateKey(l int) (string, error)

CreateKey takes in a key length and returns base64 encoding

func CreateSession

func CreateSession(dbClient db.Database, userID *protos.ObjectID, userAgent string, stayLoggedIn bool) (string, error)

CreateSession creates a session and stores it into database

func DeleteOauthAccessToken

func DeleteOauthAccessToken(dbClient db.Database, token string) error

func Hash

func Hash(password string) (string, error)

Hash takes pwd string and returns hash type string

func ValidateAccessToken

func ValidateAccessToken(dbClient db.Database, token string) (*protos.User, error)

ValidateAccessToken takes pointer to dbclient and token string to lookup and validate AccessToken

func ValidateAuthCode

func ValidateAuthCode(dbClient db.Database, code string) (*models.AuthCode, error)

ValidateAuthCode takes pointer to db client and code string, finds the code and returns it

func ValidateSession

func ValidateSession(dbClient db.Database, key string) (*protos.User, error)

ValidateSession looks up session key, check if its valid and returns a pointer to the user returns error if the key doesn't exist, or has expired

Types

This section is empty.

Jump to

Keyboard shortcuts

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