security

package
v0.0.0-...-118fa08 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSRF

func CSRF(secret string, securityCtrl *Controller) gin.HandlerFunc

CSRF is the csrf middleware

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller represents the security controller

func NewController

func NewController(userRepo *user.Repository, userSvc *user.Service) *Controller

NewController returns a new Security

func (*Controller) AttachRoutes

func (c *Controller) AttachRoutes(r *gin.RouterGroup)

AttachRoutes attaches the controller's routes to gin.RouterGroup

func (*Controller) Login

func (c *Controller) Login(ctx *gin.Context)

Login authenticates the user

func (*Controller) Logout

func (c *Controller) Logout(ctx *gin.Context)

Logout deauthenticates the user

func (*Controller) Me

func (c *Controller) Me(ctx *gin.Context)

Me returns self user

func (*Controller) Status

func (c *Controller) Status(ctx *gin.Context)

Status confirms if logged in

func (*Controller) Token

func (c *Controller) Token(ctx *gin.Context)

Token replies with a CSRF token

func (*Controller) TokenMismatch

func (c *Controller) TokenMismatch(ctx *gin.Context)

TokenMismatch is used for ErrorFunc of CSRF middleware

Jump to

Keyboard shortcuts

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