Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - func Hash(rawKey string) string
 - func IPRangeWhitelistMiddleware(whitelist []string) gin.HandlerFunc
 - func IPWhitelistMiddleware(whitelist []string) gin.HandlerFunc
 - func IntranetOnly() gin.HandlerFunc
 - func SignRequest(app, ts, secret string, request []byte) (string, error)
 - type AuthKey
 - type AuthService
 - type AuthServiceParam
 - type AuthedGroutRoute
 - func NewAuthedRouter(route *gin.Engine, auth *AuthService, logger *zap.Logger, base string, ...) AuthedGroutRoute
 - func NewDefaultAuthedRouter(route *gin.Engine, auth *AuthService, logger *zap.Logger) AuthedGroutRoute
 - func NewRouterRequiredAuth(group *gin.RouterGroup, auth *AuthService) AuthedGroutRoute
 - func NewURIAuthedRouter(route *gin.Engine, auth *AuthService, logger *zap.Logger, uri string) AuthedGroutRoute
 
- type Owner
 - type SignService
 - type StoreUser
 
Constants ¶
      View Source
      
  
const (
	KeyUser = "currentUser"
)
    Variables ¶
This section is empty.
Functions ¶
func IPRangeWhitelistMiddleware ¶ added in v0.10.14
func IPRangeWhitelistMiddleware(whitelist []string) gin.HandlerFunc
IPRangeWhitelistMiddleware 创建一个支持 IP 段的 IP 白名单中间件
func IPWhitelistMiddleware ¶ added in v0.10.14
func IPWhitelistMiddleware(whitelist []string) gin.HandlerFunc
IPWhitelistMiddleware 创建一个 IP 白名单中间件
func IntranetOnly ¶ added in v0.10.14
func IntranetOnly() gin.HandlerFunc
Types ¶
type AuthService ¶
type AuthService struct {
	Db *gorm.DB
	Keys []string
	// userCache *cache.Cache[*AuthKey]
	HeaderKey string
	// contains filtered or unexported fields
}
    func (*AuthService) Auth ¶
func (a *AuthService) Auth(c *gin.Context)
func (*AuthService) CreateUser ¶ added in v0.1.7
func (a *AuthService) CreateUser(owner, username, remark, rawKey, storeCode string) (string, error)
type AuthServiceParam ¶ added in v0.0.8
type AuthedGroutRoute ¶ added in v0.1.6
func NewAuthedRouter ¶ added in v0.1.6
func NewAuthedRouter(route *gin.Engine, auth *AuthService, logger *zap.Logger, base string, replyCode int) AuthedGroutRoute
func NewDefaultAuthedRouter ¶ added in v0.1.6
func NewDefaultAuthedRouter(route *gin.Engine, auth *AuthService, logger *zap.Logger) AuthedGroutRoute
func NewRouterRequiredAuth ¶ added in v0.0.8
func NewRouterRequiredAuth(group *gin.RouterGroup, auth *AuthService) AuthedGroutRoute
func NewURIAuthedRouter ¶ added in v0.2.1
func NewURIAuthedRouter(route *gin.Engine, auth *AuthService, logger *zap.Logger, uri string) AuthedGroutRoute
type SignService ¶ added in v0.1.12
type SignService struct {
	MaxDuration  time.Duration
	KeyTimestamp string
	KeySign      string
	KeyApp       string
	Secrets      map[string]string
	// contains filtered or unexported fields
}
    func (*SignService) CheckMaxDuration ¶ added in v0.1.12
func (ss *SignService) CheckMaxDuration(c *gin.Context)
func (*SignService) Sign ¶ added in v0.1.12
func (ss *SignService) Sign(c *gin.Context)
 Click to show internal directories. 
   Click to hide internal directories.