auth

package
v2.3.117 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2025 License: MIT Imports: 21 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

func (Auth) Authenticate added in v2.0.4

func (a Auth) Authenticate(c *gin.Context)

func (Auth) CanPermission added in v2.0.4

func (a Auth) CanPermission(c *gin.Context)

func (Auth) GetAdminID added in v2.1.0

func (a Auth) GetAdminID() int

func (Auth) InitHandler added in v2.0.4

func (a Auth) InitHandler(api *gin.RouterGroup)

func (Auth) LimiterMiddleware added in v2.3.24

func (a Auth) LimiterMiddleware(c *gin.Context)

type Config

type Config struct {
	Debug         string
	DB            *gorm.DB
	Rdb           redis.UniversalClient
	Transaction   mw.ITransaction
	Hasher        secret.Hasher
	AccessExpire  time.Duration
	RefreshExpire time.Duration
	AccessSecret  string
	Permissions   []model.Permission
	TTL           time.Duration
	MaxAttempts   int
	LdapConfig    *ldapauth.Config
}

type IAuth

type IAuth interface {
	InitHandler(api *gin.RouterGroup)
	Authenticate(c *gin.Context)
	CanPermission(c *gin.Context)
	GetAdminID() int
	LimiterMiddleware(c *gin.Context)
}

func New

func New[Model profile.IModel, CreateInput, UpdateInput, UpdateProfileInput any](cfg Config, prof *profile.Profile[Model, CreateInput, UpdateInput, UpdateProfileInput]) (IAuth, error)

Jump to

Keyboard shortcuts

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