auth

package module
v0.1.18 Latest Latest
Warning

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

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

README

iris-auth-gorm

Authentification Middleware for IRIS using gorm as a backend

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(user models.User, ctx iris.Context)

Check verifies the provided user against the DB

func CreateUser added in v0.1.13

func CreateUser(user models.User) (token string, id uint)

CreateUser allow to store a user in the DB

func HasRole added in v0.1.10

func HasRole(ctx iris.Context, role string) bool

HasRole verify if the user has the requested Role

func Init added in v0.1.10

func Init(config Config) iris.Handler

Init exports the middleware function to initialize DB if needed, and populate the ctx.User() object at each run.

func IsAuth added in v0.1.1

func IsAuth(ctx iris.Context) bool

IsAuth returns true if User has been authenticated

func MiddleAuth added in v0.1.2

func MiddleAuth(ctx iris.Context)

MiddleAuth exports the middleware function to check authentification

func MiddleRole added in v0.1.10

func MiddleRole(role string) iris.Handler

MiddleRole check if the user has the required Role

Types

type Config added in v0.1.6

type Config struct {
	DataStore     *gorm.DB
	LoginRoute    string
	ReturnOnError bool
}

Config struct allows the configuration to be passed to the function at init

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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