auth

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckJwt

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

CheckJwt if token is JWT and have time

func OpenAuthCollection

func OpenAuthCollection()

OpenAuthCollection open the collection of mongoDB called auth

func RegisterUser

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

RegisterUser function use in V1 router for sign up user

func SetPassword

func SetPassword(pass string) string

SetPassword example usage of this two functions pass := SetPassword(password)

func SignJWT

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

SignJWT function to create jwt token

func ValidPassword

func ValidPassword(hash string, pass string) bool

ValidPassword bo := ValidPassword(pass, "as") fmt.Println(pass, bo)

Types

type JWT

type JWT struct {
	User User
	Age  int
	jwt.StandardClaims
}

JWT model for save in database

type User

type User struct {
	Username string
	Password string
	Email    string
}

User model for auth staff

Jump to

Keyboard shortcuts

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