routes

package
v0.0.0-...-e143822 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Collection string

Instance variable to store the DB Collection name.

View Source
var Database string

Instance variable to store the Database name.

Functions

func AccessTokenClaims

func AccessTokenClaims(user objects.User) (claims jwt.MapClaims)

Generates claims to sign with the access token.

func DecodeUser

func DecodeUser(document *mongo.SingleResult) (v objects.User, err error)

Decodes a mongo db single result into an user object.

func GenerateTokens

func GenerateTokens(user objects.User) (objects.AuthenticationResponse, error)

func HandlerAuthorize

func HandlerAuthorize(w http.ResponseWriter, r *http.Request)

Handler for authorizing user credentials.

func HandlerGetUserByUsername

func HandlerGetUserByUsername(w http.ResponseWriter, r *http.Request)

Handler to get the user for the username.

func HandlerGetUsers

func HandlerGetUsers(w http.ResponseWriter, r *http.Request)

Handler to get users for the leaderboard.

func HandlerNewUser

func HandlerNewUser(w http.ResponseWriter, r *http.Request)

Handler for creating a new user.

func HandlerRefreshToken

func HandlerRefreshToken(w http.ResponseWriter, r *http.Request)

Handler for generating access token after verifying refresh token.

func HandlerUpdateUser

func HandlerUpdateUser(w http.ResponseWriter, r *http.Request)

Handler for updating user into the mongo database.

func Hash

func Hash(s string) [32]byte

Generate the hash string using the SHA256 algorithm for the password.

func RefreshTokenClaims

func RefreshTokenClaims(user objects.User) (claims jwt.MapClaims)

Generates claims to sign with the refresh token.

func Routes

func Routes() *http.ServeMux

Types

This section is empty.

Jump to

Keyboard shortcuts

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