Documentation
¶
Index ¶
- Constants
- func GenerateSalt(salt int) string
- func Guard(ctrl core.RefProvider, ctx *core.Ctx) bool
- func Hash(str string, salt ...int) string
- func Register(opt JwtOptions) core.Module
- func RoleGuard(ctrl core.RefProvider, ctx *core.Ctx) bool
- func Roles(roles ...string) *core.Metadata
- func VerifyHash(hashedStr string, plainStr string) bool
- type Crypto
- type Jwt
- type JwtHS256
- type JwtOptions
- type JwtRS256
- type SubOptions
Constants ¶
View Source
const JWT_TOKEN core.Provide = "JWT_TOKEN"
View Source
const ROLES = "ROLES"
View Source
const USER core.CtxKey = "USER"
Variables ¶
This section is empty.
Functions ¶
func GenerateSalt ¶
func Register ¶
func Register(opt JwtOptions) core.Module
func VerifyHash ¶
Types ¶
type Jwt ¶
type Jwt interface {
Generate(payload jwt.MapClaims) (string, error)
Verify(token string) (jwt.MapClaims, error)
}
func InjectJwt ¶
func InjectJwt(module *core.DynamicModule) Jwt
func NewJwt ¶
func NewJwt(opt JwtOptions) Jwt
type JwtHS256 ¶
type JwtHS256 struct {
Secret string
Opt SubOptions
}
func NewJwtHS256 ¶
func NewJwtHS256(opt JwtOptions) *JwtHS256
type JwtOptions ¶
type JwtRS256 ¶
type JwtRS256 struct {
PrivateKey string
PublicKey string
Opt SubOptions
}
func NewJwtRS256 ¶
func NewJwtRS256(opt JwtOptions) *JwtRS256
type SubOptions ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.