jwt

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() auth.IAuthFactory

NewFactory 生成一个 auth_apiKey工厂

func ParseECPublicKeyFromPEM

func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error)

ParseECPublicKeyFromPEM parse PEM encoded PKCS1 or PKCS8 public key

func ParseRSAPublicKeyFromPEM

func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error)

ParseRSAPublicKeyFromPEM parse PEM encoded PKCS1 or PKCS8 public key

func Register

func Register()

Register 注册auth驱动工厂

Types

type Config

type Config struct {
	application.Auth
	Config *Rule   `json:"config" label:"JWT配置"`
	Users  []*User `json:"users" label:"用户列表"`
}

type Pattern

type Pattern struct {
	Username string `json:"username" label:"用户名"`
}

type Rule

type Rule struct {
	Iss               string   `json:"iss" label:"签发机构"`
	Algorithm         string   `json:"algorithm" label:"签名算法" enum:"HS256,HS384,HS512,RS256,RS384,RS512,ES256,ES384,ES512"`
	Secret            string   `json:"secret" label:"密钥" switch:"algorithm==='HS256'||algorithm==='HS384'||algorithm==='HS512'"`
	RsaPublicKey      string   `json:"rsa_public_key" label:"RSA公钥" switch:"algorithm!=='HS256'&&algorithm!=='HS384'&&algorithm!=='HS512'"`
	Path              string   `json:"path" label:"用户名JsonPath"`
	ClaimsToVerify    []string `json:"claims_to_verify" label:"检验字段"`
	SignatureIsBase64 bool     `` /* 131-byte string literal not displayed */
}

func (*Rule) ToID

func (c *Rule) ToID() (string, error)

type User

type User struct {
	Pattern Pattern `json:"pattern" label:"用户信息"`
	application.User
}

func (*User) Username

func (u *User) Username() string

Jump to

Keyboard shortcuts

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