Documentation
¶
Index ¶
- func CheckEncryption(config *ModConfig, serviceName, groupName string) bool
- func CheckPassword(inputPassword, targetPassword string) bool
- func DecodeURIComponent(str string) string
- func EncodeURIComponent(str string) string
- func EncryptionMiddleware(app *App) fiber.Handler
- func GenPassword(inputPassword string) (string, error)
- func JSONParse(s string, v any) error
- func JSONStringify(v any, format ...bool) string
- func JWTMiddleware(app *App) fiber.Handler
- func MD5Str(str string) string
- func NewRandomNumber(length int) string
- func NewUUID(upper bool, hyphen bool) string
- func NewUUIDToken() string
- func NextSnowflakeID() snowflake.ID
- func NextSnowflakeIntID() int64
- func NextSnowflakeStringID() string
- func OptionalJWTMiddleware(app *App) fiber.Handler
- func Reply(code int, msg string) error
- func ReplyWithDetail(code int, msg, detail string) error
- func RoleMiddleware(requiredRoles ...string) fiber.Handler
- func SplitAndTrimSpace(s, sep string) []string
- type ApiResponse
- type App
- func (app *App) CheckServicePermission(token string, permission *PermissionConfig) bool
- func (app *App) Close() error
- func (app *App) Debug(args ...any)
- func (app *App) Debugf(format string, args ...any)
- func (app *App) DecryptData(data []byte, mode string) ([]byte, error)
- func (app *App) EncryptData(data []byte, mode string) ([]byte, error)
- func (app *App) Error(args ...any)
- func (app *App) Errorf(format string, args ...any)
- func (app *App) GenerateJWT(userID, username, email, role string, extra map[string]any) (*TokenResponse, error)
- func (app *App) GetJWTManager() *JWTManager
- func (app *App) GetLogger() *logrus.Logger
- func (app *App) GetModConfig() *ModConfig
- func (app *App) GetTokenData(token string) ([]byte, error)
- func (app *App) Info(args ...any)
- func (app *App) Infof(format string, args ...any)
- func (app *App) Logger() *logrus.Logger
- func (app *App) RefreshJWT(refreshToken string) (*TokenResponse, error)
- func (app *App) Register(svc Service) error
- func (app *App) RemoveToken(token string) error
- func (app *App) RevokeJWT(tokenString string) error
- func (app *App) Run(addr ...string)
- func (app *App) SetToken(token string, data any) error
- func (app *App) SignData(data []byte) ([]byte, error)
- func (app *App) UseEncryption()
- func (app *App) UseJWT()
- func (app *App) UseOptionalJWT()
- func (app *App) ValidateJWT(tokenString string) (*JWTClaims, error)
- func (app *App) VerifySignature(data, signature []byte) error
- func (app *App) Warn(args ...any)
- func (app *App) Warnf(format string, args ...any)
- func (app *App) WithError(err error) *logrus.Entry
- func (app *App) WithField(key string, value any) *logrus.Entry
- func (app *App) WithFields(fields logrus.Fields) *logrus.Entry
- type AsymmetricEncryption
- type Config
- type Context
- func (c *Context) App() *App
- func (c *Context) Debug(args ...any)
- func (c *Context) Debugf(format string, args ...any)
- func (c *Context) Error(args ...any)
- func (c *Context) Errorf(format string, args ...any)
- func (c *Context) GetJWTClaims() *JWTClaims
- func (c *Context) GetJWTToken() string
- func (c *Context) GetLogger() *logrus.Logger
- func (c *Context) GetRequestID() string
- func (c *Context) GetUserEmail() string
- func (c *Context) GetUserID() string
- func (c *Context) GetUserRole() string
- func (c *Context) GetUsername() string
- func (c *Context) HasAnyRole(roles ...string) bool
- func (c *Context) HasRole(role string) bool
- func (c *Context) Info(args ...any)
- func (c *Context) Infof(format string, args ...any)
- func (c *Context) IsAuthenticated() bool
- func (c *Context) Logger() *logrus.Logger
- func (c *Context) Warn(args ...any)
- func (c *Context) Warnf(format string, args ...any)
- func (c *Context) WithFields(fields logrus.Fields) *logrus.Entry
- type DocData
- type DocField
- type DocGroup
- type DocService
- type EncryptedRequest
- type EncryptedResponse
- type EncryptionManager
- type Handler
- type JWTClaims
- type JWTManager
- func (j *JWTManager) ExtractTokenFromRequest(ctx *Context) string
- func (j *JWTManager) GenerateTokens(userID, username, email, role string, extra map[string]any) (*TokenResponse, error)
- func (j *JWTManager) IsEnabled() bool
- func (j *JWTManager) IsTokenBlacklisted(tokenString string) bool
- func (j *JWTManager) RefreshToken(refreshTokenString string) (*TokenResponse, error)
- func (j *JWTManager) RevokeToken(tokenString string) error
- func (j *JWTManager) ValidateToken(tokenString string) (*JWTClaims, error)
- type MockGenerator
- type ModConfig
- type PermissionConfig
- type PermissionRule
- type Service
- type SignatureVerification
- type StdReply
- type SymmetricEncryption
- type TokenResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckEncryption ¶
CheckEncryption 检查是否需要加密
func CheckPassword ¶
func DecodeURIComponent ¶
func EncodeURIComponent ¶
func EncryptionMiddleware ¶
EncryptionMiddleware 加解密中间件
func GenPassword ¶
func JSONStringify ¶
func JWTMiddleware ¶
JWTMiddleware creates a JWT authentication middleware
func NewRandomNumber ¶
func NewUUIDToken ¶
func NewUUIDToken() string
func NextSnowflakeID ¶
func NextSnowflakeIntID ¶
func NextSnowflakeIntID() int64
func NextSnowflakeStringID ¶
func NextSnowflakeStringID() string
func OptionalJWTMiddleware ¶
OptionalJWTMiddleware creates an optional JWT authentication middleware It validates JWT if present but doesn't fail if missing
func ReplyWithDetail ¶
func RoleMiddleware ¶
RoleMiddleware creates a role-based authorization middleware
func SplitAndTrimSpace ¶
Types ¶
type ApiResponse ¶
type ApiResponse struct {
Code int `json:"code"`
Data any `json:"data,omitempty"`
Msg string `json:"msg"`
Detail string `json:"detail,omitempty"`
Rid string `json:"rid"`
}
统一响应格式
func NewErrorResponse ¶
func NewErrorResponse(ctx *Context, code int, msg string, detail ...string) *ApiResponse
生成错误响应
type App ¶
func (*App) CheckServicePermission ¶
func (app *App) CheckServicePermission(token string, permission *PermissionConfig) bool
CheckServicePermission 检查服务权限
func (*App) DecryptData ¶
DecryptData decrypts data using the configured symmetric or asymmetric algorithm
func (*App) EncryptData ¶
EncryptData encrypts data using the configured symmetric or asymmetric algorithm
func (*App) GenerateJWT ¶
func (app *App) GenerateJWT(userID, username, email, role string, extra map[string]any) (*TokenResponse, error)
GenerateJWT generates JWT tokens for a user
func (*App) GetJWTManager ¶
func (app *App) GetJWTManager() *JWTManager
GetJWTManager returns the JWT manager for the app
func (*App) GetModConfig ¶
GetModConfig returns the loaded mod.yml configuration Returns nil if no mod.yml was loaded
func (*App) GetTokenData ¶
GetTokenData 从缓存中获取 token 相关的数据 这个方法可以用来获取存储在 token 中的用户信息等数据
func (*App) RefreshJWT ¶
func (app *App) RefreshJWT(refreshToken string) (*TokenResponse, error)
RefreshJWT refreshes a JWT token using refresh token
func (*App) RemoveToken ¶
RemoveToken 从缓存中删除 token 这个方法可以在用户登出时调用,使 token 失效
func (*App) UseEncryption ¶
func (app *App) UseEncryption()
UseEncryption enables encryption middleware for all routes
func (*App) UseOptionalJWT ¶
func (app *App) UseOptionalJWT()
UseOptionalJWT enables optional JWT middleware for all routes
func (*App) ValidateJWT ¶
ValidateJWT validates a JWT token
func (*App) VerifySignature ¶
VerifySignature verifies a digital signature for the given data
type AsymmetricEncryption ¶
type AsymmetricEncryption struct {
Algorithm string
PublicKey *rsa.PublicKey
PrivateKey *rsa.PrivateKey
}
AsymmetricEncryption 非对称加密
func NewAsymmetricEncryption ¶
func NewAsymmetricEncryption(config *ModConfig) (*AsymmetricEncryption, error)
NewAsymmetricEncryption 创建非对称加密实例
type Context ¶
func (*Context) GetJWTClaims ¶
GetJWTClaims returns the JWT claims from the context
func (*Context) GetJWTToken ¶
GetJWTToken returns the JWT token string from the context
func (*Context) GetRequestID ¶
func (*Context) GetUserEmail ¶
GetUserEmail returns the user email from JWT claims
func (*Context) GetUserRole ¶
GetUserRole returns the user role from JWT claims
func (*Context) GetUsername ¶
GetUsername returns the username from JWT claims
func (*Context) HasAnyRole ¶
HasAnyRole checks if the current user has any of the specified roles
func (*Context) IsAuthenticated ¶
IsAuthenticated checks if the request has valid JWT authentication
type DocData ¶
type DocData struct {
AppInfo struct {
Name string
DisplayName string
Description string
Version string
}
Groups []DocGroup
}
DocData contains all documentation data including app info and service groups
type DocField ¶
type DocField struct {
Name string
Type string
Description string
Required bool
From string // query, header, form, param
Tag string
Level int // 嵌套层级,0为顶层
Parent string // 父字段名
Children []DocField // 子字段(用于对象类型)
IsObject bool // 是否为对象类型
IsArray bool // 是否为数组类型
ArrayItemType string // 数组元素类型
}
文档生成相关结构体
type DocGroup ¶
type DocGroup struct {
Name string
Services []DocService
}
type DocService ¶
type EncryptedRequest ¶
type EncryptedRequest struct {
Data string `json:"data"` // Base64编码的加密数据
Signature string `json:"signature"` // Base64编码的签名
Mode string `json:"mode"` // 加密模式: symmetric/asymmetric
}
EncryptedRequest 加密的请求格式
type EncryptedResponse ¶
type EncryptedResponse struct {
Data string `json:"data"` // Base64编码的加密数据
Signature string `json:"signature"` // Base64编码的签名
Mode string `json:"mode"` // 加密模式: symmetric/asymmetric
}
EncryptedResponse 加密的响应格式
type EncryptionManager ¶
type EncryptionManager struct {
// contains filtered or unexported fields
}
EncryptionManager 加解密管理器
func NewEncryptionManager ¶
func NewEncryptionManager(config *ModConfig) *EncryptionManager
NewEncryptionManager 创建加解密管理器
type Handler ¶
type Handler struct {
Func func(ctx *Context, args, reply any) error
InputType reflect.Type
OutputType reflect.Type
}
Handler 结构体,可以存储类型信息
type JWTClaims ¶
type JWTClaims struct {
UserID string `json:"user_id"`
Username string `json:"username"`
Email string `json:"email"`
Role string `json:"role"`
Extra map[string]any `json:"extra,omitempty"`
jwt.RegisteredClaims
}
JWTClaims represents the JWT claims structure
type JWTManager ¶
type JWTManager struct {
// contains filtered or unexported fields
}
JWTManager manages JWT token operations
func NewJWTManager ¶
func NewJWTManager(app *App) *JWTManager
NewJWTManager creates a new JWT manager instance
func (*JWTManager) ExtractTokenFromRequest ¶
func (j *JWTManager) ExtractTokenFromRequest(ctx *Context) string
ExtractTokenFromRequest extracts JWT token from HTTP request
func (*JWTManager) GenerateTokens ¶
func (j *JWTManager) GenerateTokens(userID, username, email, role string, extra map[string]any) (*TokenResponse, error)
GenerateTokens generates both access and refresh tokens
func (*JWTManager) IsEnabled ¶
func (j *JWTManager) IsEnabled() bool
IsEnabled checks if JWT is enabled in configuration
func (*JWTManager) IsTokenBlacklisted ¶
func (j *JWTManager) IsTokenBlacklisted(tokenString string) bool
IsTokenBlacklisted checks if a token is in the blacklist
func (*JWTManager) RefreshToken ¶
func (j *JWTManager) RefreshToken(refreshTokenString string) (*TokenResponse, error)
RefreshToken refreshes an access token using a refresh token
func (*JWTManager) RevokeToken ¶
func (j *JWTManager) RevokeToken(tokenString string) error
RevokeToken revokes a token by adding it to the cache blacklist
func (*JWTManager) ValidateToken ¶
func (j *JWTManager) ValidateToken(tokenString string) (*JWTClaims, error)
ValidateToken validates a JWT token and returns the claims
type MockGenerator ¶
type MockGenerator struct {
// contains filtered or unexported fields
}
MockGenerator 负责根据结构体定义生成Mock数据
func (*MockGenerator) GenerateMockData ¶
func (m *MockGenerator) GenerateMockData(t reflect.Type) any
GenerateMockData 根据类型生成Mock数据
type ModConfig ¶
type ModConfig struct {
App struct {
// 应用基础信息
Name string `yaml:"name"`
DisplayName string `yaml:"display_name"`
Description string `yaml:"description"`
Version string `yaml:"version"`
ServiceBase string `yaml:"service_base"`
TokenKeys []string `yaml:"token_keys"`
} `yaml:"app"`
// 服务器配置 - 从app中拆分出来的独立配置
Server struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
ReadTimeout string `yaml:"read_timeout"`
WriteTimeout string `yaml:"write_timeout"`
IdleTimeout string `yaml:"idle_timeout"`
ReadBufferSize int `yaml:"read_buffer_size"`
WriteBufferSize int `yaml:"write_buffer_size"`
CompressedFileSuffix string `yaml:"compressed_file_suffix"`
ProxyHeader string `yaml:"proxy_header"`
GETOnly bool `yaml:"get_only"`
DisableKeepalive bool `yaml:"disable_keepalive"`
DisableDefaultDate bool `yaml:"disable_default_date"`
DisableDefaultContentType bool `yaml:"disable_default_content_type"`
DisableHeaderNormalizing bool `yaml:"disable_header_normalizing"`
DisableStartupMessage bool `yaml:"disable_startup_message"`
EnableTrustedProxyCheck bool `yaml:"enable_trusted_proxy_check"`
Prefork bool `yaml:"prefork"`
StrictRouting bool `yaml:"strict_routing"`
CaseSensitive bool `yaml:"case_sensitive"`
UnescapePath bool `yaml:"unescape_path"`
ETag bool `yaml:"etag"`
BodyLimit string `yaml:"body_limit"`
Concurrency int `yaml:"concurrency"`
Views string `yaml:"views"`
TrustedProxies []string `yaml:"trusted_proxies"`
// CORS跨域配置
CORS struct {
Enabled bool `yaml:"enabled"` // 是否启用CORS
AllowOrigins []string `yaml:"allow_origins"` // 允许的源
AllowMethods []string `yaml:"allow_methods"` // 允许的HTTP方法
AllowHeaders []string `yaml:"allow_headers"` // 允许的请求头
AllowCredentials bool `yaml:"allow_credentials"` // 是否允许携带凭证
ExposeHeaders []string `yaml:"expose_headers"` // 暴露的响应头
MaxAge string `yaml:"max_age"` // 预检请求缓存时间
} `yaml:"cors"`
} `yaml:"server"`
Cache struct {
BigCache struct {
Enabled bool `yaml:"enabled"`
Shards int `yaml:"shards"`
LifeWindow string `yaml:"life_window"`
CleanWindow string `yaml:"clean_window"`
MaxEntriesInWindow int `yaml:"max_entries_in_window"`
MaxEntrySize int `yaml:"max_entry_size"`
Verbose bool `yaml:"verbose"`
HardMaxCacheSize int `yaml:"hard_max_cache_size"`
} `yaml:"bigcache"`
Badger struct {
Enabled bool `yaml:"enabled"`
Path string `yaml:"path"`
InMemory bool `yaml:"in_memory"`
SyncWrites bool `yaml:"sync_writes"`
ValueLogFileSize int `yaml:"value_log_file_size"`
NumCompactors int `yaml:"num_compactors"`
NumLevelZeroTables int `yaml:"num_level_zero_tables"`
NumLevelZeroTablesStall int `yaml:"num_level_zero_tables_stall"`
ValueLogLoadSize int `yaml:"value_log_load_size"`
TTL string `yaml:"ttl"` // Token 过期时间
} `yaml:"badger"`
Redis struct {
Enabled bool `yaml:"enabled"`
Address string `yaml:"address"`
Password string `yaml:"password"`
DB int `yaml:"db"`
PoolSize int `yaml:"pool_size"`
MinIdleConns int `yaml:"min_idle_conns"`
DialTimeout string `yaml:"dial_timeout"`
ReadTimeout string `yaml:"read_timeout"`
WriteTimeout string `yaml:"write_timeout"`
IdleTimeout string `yaml:"idle_timeout"`
MaxConnAge string `yaml:"max_conn_age"`
TTL string `yaml:"ttl"` // Token 过期时间
} `yaml:"redis"`
} `yaml:"cache"`
RSAKeys struct {
PrivateKey string `yaml:"private_key"`
PublicKey string `yaml:"public_key"`
} `yaml:"rsa_keys"`
FileUpload struct {
Local struct {
Enabled bool `yaml:"enabled"` // 是否启用本地文件上传
UploadDir string `yaml:"upload_dir"` // 上传目录路径
MaxSize string `yaml:"max_size"` // 单文件最大大小
AllowedTypes []string `yaml:"allowed_types"` // 允许的文件MIME类型
AllowedExts []string `yaml:"allowed_exts"` // 允许的文件扩展名
KeepOriginalName bool `yaml:"keep_original_name"` // 是否保持原始文件名
AutoCreateDir bool `yaml:"auto_create_dir"` // 自动创建上传目录
DateSubDir bool `yaml:"date_sub_dir"` // 按日期创建子目录
} `yaml:"local"`
S3 struct {
Enabled bool `yaml:"enabled"`
Bucket string `yaml:"bucket"`
Region string `yaml:"region"`
AccessKey string `yaml:"access_key"`
SecretKey string `yaml:"secret_key"`
Endpoint string `yaml:"endpoint"`
} `yaml:"s3"`
OSS struct {
Enabled bool `yaml:"enabled"`
Bucket string `yaml:"bucket"`
Endpoint string `yaml:"endpoint"`
AccessKeyID string `yaml:"access_key_id"`
AccessKeySecret string `yaml:"access_key_secret"`
} `yaml:"oss"`
} `yaml:"file_upload"`
StaticMounts []struct {
URLPrefix string `yaml:"url_prefix"`
LocalPath string `yaml:"local_path"`
Browseable bool `yaml:"browseable"`
IndexFile string `yaml:"index_file"`
} `yaml:"static_mounts"`
Logging struct {
Console struct {
Enabled bool `yaml:"enabled"`
Level string `yaml:"level"`
} `yaml:"console"`
Loki struct {
Enabled bool `yaml:"enabled"`
URL string `yaml:"url"`
Labels map[string]string `yaml:"labels"`
BatchSize int `yaml:"batch_size"`
Timeout string `yaml:"timeout"`
} `yaml:"loki"`
SLS struct {
Enabled bool `yaml:"enabled"`
Endpoint string `yaml:"endpoint"`
Project string `yaml:"project"`
Logstore string `yaml:"logstore"`
AccessKeyID string `yaml:"access_key_id"`
AccessKeySecret string `yaml:"access_key_secret"`
} `yaml:"sls"`
File struct {
Enabled bool `yaml:"enabled"`
Path string `yaml:"path"`
MaxSize string `yaml:"max_size"`
MaxBackups int `yaml:"max_backups"`
MaxAge string `yaml:"max_age"`
Compress bool `yaml:"compress"`
} `yaml:"file"`
} `yaml:"logging"`
Token struct {
JWT struct {
Enabled bool `yaml:"enabled"`
SecretKey string `yaml:"secret_key"`
Issuer string `yaml:"issuer"`
ExpireDuration string `yaml:"expire_duration"`
RefreshExpireDuration string `yaml:"refresh_expire_duration"`
Algorithm string `yaml:"algorithm"`
} `yaml:"jwt"`
Validation struct {
Enabled bool `yaml:"enabled"`
SkipExpiredCheck bool `yaml:"skip_expired_check"`
CacheStrategy string `yaml:"cache_strategy"` // "bigcache", "badger", "redis"
CacheKeyPrefix string `yaml:"cache_key_prefix"`
} `yaml:"validation"`
} `yaml:"token"`
// 服务加解密配置 - 支持三个级别的加解密设置
Encryption struct {
// 全局加解密设置
Global struct {
Enabled bool `yaml:"enabled"` // 是否启用全局加解密
Algorithm string `yaml:"algorithm"` // 加密算法: AES256-GCM, RSA-OAEP, ChaCha20-Poly1305
Mode string `yaml:"mode"` // 加密模式: symmetric, asymmetric
} `yaml:"global"`
// 对称加密配置
Symmetric struct {
Algorithm string `yaml:"algorithm"` // AES256-GCM, ChaCha20-Poly1305
Key string `yaml:"key"` // 加密密钥 (base64编码)
KeyFile string `yaml:"key_file"` // 密钥文件路径
} `yaml:"symmetric"`
// 非对称加密配置
Asymmetric struct {
Algorithm string `yaml:"algorithm"` // RSA-OAEP, ECDH
PublicKey string `yaml:"public_key"` // 公钥内容 (PEM格式)
PrivateKey string `yaml:"private_key"` // 私钥内容 (PEM格式)
PublicKeyFile string `yaml:"public_key_file"` // 公钥文件路径
PrivateKeyFile string `yaml:"private_key_file"` // 私钥文件路径
KeySize int `yaml:"key_size"` // RSA密钥长度 (2048, 3072, 4096)
} `yaml:"asymmetric"`
// 签名验证配置
Signature struct {
Enabled bool `yaml:"enabled"` // 是否启用签名验证
Algorithm string `yaml:"algorithm"` // 签名算法: HMAC-SHA256, RSA-PSS, ECDSA
Key string `yaml:"key"` // 签名密钥
KeyFile string `yaml:"key_file"` // 签名密钥文件路径
} `yaml:"signature"`
// 分组级别加解密设置
Groups map[string]struct {
Enabled bool `yaml:"enabled"` // 是否启用该分组的加解密
Algorithm string `yaml:"algorithm"` // 覆盖全局算法设置
Mode string `yaml:"mode"` // 覆盖全局模式设置
} `yaml:"groups"`
// 服务级别加解密设置
Services map[string]struct {
Enabled bool `yaml:"enabled"` // 是否启用该服务的加解密
Algorithm string `yaml:"algorithm"` // 覆盖全局算法设置
Mode string `yaml:"mode"` // 覆盖全局模式设置
} `yaml:"services"`
// 白名单服务 - 跳过加解密验证
Whitelist struct {
Groups []string `yaml:"groups"` // 白名单分组
Services []string `yaml:"services"` // 白名单服务
} `yaml:"whitelist"`
} `yaml:"encryption"`
// Mock配置 - 支持三个级别的Mock设置
Mock struct {
// 全局Mock设置
Global struct {
Enabled bool `yaml:"enabled"` // 是否启用全局Mock
} `yaml:"global"`
// 分组级别Mock设置
Groups map[string]struct {
Enabled bool `yaml:"enabled"` // 是否启用该分组的Mock
} `yaml:"groups"`
// 服务级别Mock设置
Services map[string]struct {
Enabled bool `yaml:"enabled"` // 是否启用该服务的Mock
} `yaml:"services"`
} `yaml:"mock"`
}
ModConfig represents the structure of mod.yml configuration file
type PermissionConfig ¶
type PermissionConfig struct {
// 权限规则列表,支持AND/OR逻辑
Rules []PermissionRule `json:"rules"`
// 规则之间的逻辑关系:AND(默认)或 OR
Logic string `json:"logic"` // "AND" | "OR"
}
PermissionConfig 权限配置
type PermissionRule ¶
type PermissionRule struct {
// Token缓存数据中的字段路径,如 "user.role", "permissions.admin", "department.level"
Field string `json:"field"`
// 操作符:eq, ne, in, not_in, gt, gte, lt, lte, contains, exists
Operator string `json:"operator"`
// 期望值
Value any `json:"value"`
}
PermissionRule 权限规则
type Service ¶
type Service struct {
Name string `validate:"required"`
DisplayName string `validate:"required"`
Handler Handler `validate:"required"`
Description string
SkipAuth bool
ReturnRaw bool
Group string // 在文档中的分组
Sort int // 在文档中的排序值,从小到大排列
// 权限控制配置
Permission *PermissionConfig `json:"permission,omitempty"`
}
type SignatureVerification ¶
SignatureVerification 签名验证
func NewSignatureVerification ¶
func NewSignatureVerification(config *ModConfig) *SignatureVerification
NewSignatureVerification 创建签名验证实例
type SymmetricEncryption ¶
SymmetricEncryption 对称加密
func NewSymmetricEncryption ¶
func NewSymmetricEncryption(config *ModConfig) (*SymmetricEncryption, error)
NewSymmetricEncryption 创建对称加密实例
type TokenResponse ¶
type TokenResponse struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
AccessTokenExpiresIn int64 `json:"access_token_expires_in"`
RefreshTokenExpiresIn int64 `json:"refresh_token_expires_in"`
TokenType string `json:"token_type"`
}
TokenResponse represents the token response structure
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
basic-services
command
|
|
|
encryption
command
|
|
|
file-upload
command
|
|
|
jwt-auth
command
|
|
|
logging
command
|
|
|
mock
command
|
|
|
static-files
command
|