Documentation
¶
Index ¶
- Variables
- func ParseRsaPublicKeyByJWK(jsonBytes []byte) (publicKey *rsa.PublicKey, err error)
- func RsaPublicKeyToJWK(pub *rsa.PublicKey) ([]byte, error)
- func VerifyJwtSign(ciphertext, key []byte) (json.RawMessage, error)
- func VerifyJwtSignByEcdsa(ciphertext []byte, publicKey *ecdsa.PublicKey) (json.RawMessage, error)
- func VerifyJwtSignByHmacHash(ciphertext, key []byte) (json.RawMessage, error)
- func VerifyJwtSignByRsa(ciphertext []byte, publicKey *rsa.PublicKey) (json.RawMessage, error)
- type JWK
- type JwtPayload
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrECDSANilPubKey is the error for trying to verify a JWT with a nil public key. ErrECDSANilPubKey = errors.New("jwt: ECDSA public key is nil") // ErrECDSAVerification is the error for an invalid ECDSA signature. ErrECDSAVerification = errors.New("jwt: ECDSA verification failed") // ErrRSANilPubKey is the error for trying to verify a JWT with a nil public key. ErrRSANilPubKey = errors.New("jwt: RSA public key is nil") // ErrRSAVerification is the error for an invalid RSA signature. ErrRSAVerification = errors.New("jwt: RSA verification failed") // ErrHmacVerification is the error for an invalid RSA signature. ErrHmacVerification = errors.New("jwt: Hmac verification failed") )
Functions ¶
func ParseRsaPublicKeyByJWK ¶
func VerifyJwtSign ¶
func VerifyJwtSign(ciphertext, key []byte) (json.RawMessage, error)
VerifyJwtSign verify jwt sign text , key is hmac key or rsa/ecdsa public key
func VerifyJwtSignByEcdsa ¶
func VerifyJwtSignByHmacHash ¶
func VerifyJwtSignByHmacHash(ciphertext, key []byte) (json.RawMessage, error)
func VerifyJwtSignByRsa ¶
Types ¶
type JwtPayload ¶
type JwtPayload struct {
JTI string `json:"jti"`
IAT int `json:"iat"`
EXP int `json:"exp"`
NBF int `json:"nbf"`
ISS string `json:"iss"`
Sub string `json:"sub"`
Aud string `json:"aud"`
Roles []interface{} `json:"roles"`
AuthType string `json:"authType"`
UserId string `json:"userId"`
SubjectId string `json:"subjectId"`
Email string `json:"email"`
}
Click to show internal directories.
Click to hide internal directories.