auth

package
v0.0.0-...-7cbe417 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Login

func Login(c *gin.Context)

Login Route

func Middleware

func Middleware() gin.HandlerFunc

Middleware to validate Authorization Headers TODO: Use JWT

func Register

func Register(c *gin.Context)

Register creates a new user

func Routes

func Routes(r *gin.RouterGroup)

Routes related to auth package

Types

type Credentials

type Credentials struct {
	Username string `json:"username" binding:"required" `
	Password string `json:"password" binding:"required" `
}

Credentials struct used to parse login requests

func (*Credentials) Encrypt

func (c *Credentials) Encrypt(salt string)

Encrypt password using sha256

type Jwt

type Jwt struct {
	User uuid.UUID `json:"user"`
	jwt.StandardClaims
}

Jwt struct to generate and validate jtw tokens

Jump to

Keyboard shortcuts

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