auth

package
v2.3.219 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: MIT Imports: 26 Imported by: 0

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(engine *gin.Engine, api *gin.RouterGroup, handlers ...gin.HandlerFunc)

func (Auth) LimiterMiddleware added in v2.3.24

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

type Config

type Config struct {
	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
	SSO           SSO
}

type IAuth

type IAuth interface {
	InitHandler(engine *gin.Engine, api *gin.RouterGroup, handlers ...gin.HandlerFunc)
	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](
	ctx context.Context,
	serviceName string,
	version string,
	cfg Config,
	prof *profile.Profile[Model, CreateInput, UpdateInput, UpdateProfileInput],
) (IAuth, error)

type SSO added in v2.3.146

type SSO struct {
	LDAP ldap.Config
	OIDC oidc.Config
	SAML saml.Config
}

Jump to

Keyboard shortcuts

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