Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type JwtAuth ¶
type JwtAuth struct { *JwtValidator // contains filtered or unexported fields }
JwtAuth 用于颁发jwt授权
func NewJwtAuth ¶
type JwtValidator ¶
type JwtValidator struct {
// contains filtered or unexported fields
}
JwtValidator 用于验证jwt token
func NewJwtValidator ¶
func NewJwtValidator(opts ...ValidateOption) *JwtValidator
func (*JwtValidator) GetToken ¶
func (jv *JwtValidator) GetToken(token string) (*PlatoClaims, error)
GetToken 解析并获取token结构体
type Option ¶
type Option func(options *Options)
func WithOption ¶
WithOption 通过另一个Options来更新Options 注意,所有的默认值无法被更新,以防误设置
type Options ¶
type Options struct { *ValidateOptions `yaml:"validate"` //TokenExpires token 过期时间 TokenExpiresTime int `yaml:"token_expires_time"` //TokenRefreshTime token 刷新续期时间 TokenRefreshTime int `yaml:"token_refresh_time"` //PrivateKeyPath 私钥路径 PrivateKeyPath string `yaml:"private_key_path"` }
func NewDefaultOptions ¶
func NewDefaultOptions() *Options
type PlatoClaims ¶
type ValidateOption ¶
type ValidateOption func(options *ValidateOptions)
func WithPubKeyPath ¶
func WithPubKeyPath(path string) ValidateOption
func WithValidateOption ¶
func WithValidateOption(o *ValidateOptions) ValidateOption
WithValidateOption 通过另一个ValidateOptions来更新ValidateOptions 注意,所有的默认值无法被更新,以防误设置
type ValidateOptions ¶
type ValidateOptions struct { // PublicKeyPath 公钥路径 PublicKeyPath string `yaml:"public_key_path"` }
func NewDefaultValidateOptions ¶
func NewDefaultValidateOptions() *ValidateOptions
Click to show internal directories.
Click to hide internal directories.