Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAlgorithm(alg Algorithm) error
- func EncodeClaims(claims Claimer) (string, error)
- func SliceHasString[T ~string](haystack []T, needle T) bool
- type Algorithm
- type Claimer
- type ErrAlgorithmNotSupported
- type ErrDecoding
- type ErrEncoding
- type Factory
- type JOSEHeader
- type JWK
- type JWKType
- type RegisteredClaims
- type StringOrSlice
Constants ¶
View Source
const (
JOSETypeJWT = "JWT"
)
Variables ¶
View Source
var (
ErrVerifyFail = errors.New("token verification failed")
)
Functions ¶
func CheckAlgorithm ¶
func EncodeClaims ¶
func SliceHasString ¶
Types ¶
type ErrAlgorithmNotSupported ¶
type ErrAlgorithmNotSupported struct {
Algorithm string
}
func (*ErrAlgorithmNotSupported) Error ¶
func (e *ErrAlgorithmNotSupported) Error() string
type ErrDecoding ¶
func (*ErrDecoding) Error ¶
func (e *ErrDecoding) Error() string
type ErrEncoding ¶
func (*ErrEncoding) Error ¶
func (e *ErrEncoding) Error() string
type JOSEHeader ¶
type JOSEHeader struct { Algorithm Algorithm `json:"alg,omitempty"` Type string `json:"typ,omitempty"` ContentType string `json:"cty,omitempty"` KeyID string `json:"kid,omitempty"` }
JOSEHeader defines a JOSE (JSON Object Singing and Encryption) header specified in RFC 7515.
func (JOSEHeader) Encode ¶
func (jh JOSEHeader) Encode() (string, error)
type RegisteredClaims ¶
type RegisteredClaims struct { Issuer string `json:"iss,omitempty"` Subject string `json:"sub,omitempty"` Audience StringOrSlice `json:"aud,omitempty"` ExpiresAt *numericdate.NumericDate `json:"exp,omitempty"` NotBefore *numericdate.NumericDate `json:"nbf,omitempty"` IssuedAt *numericdate.NumericDate `json:"iat,omitempty"` JWTID string `json:"jti,omitempty"` }
RegisteredClaims defines the registered JWT claims according to RFC7519, section 4.1. It also holds any public claims.
func NewRegisteredClaims ¶
func NewRegisteredClaims() (*RegisteredClaims, error)
func (*RegisteredClaims) Encode ¶
func (clms *RegisteredClaims) Encode() (string, error)
type StringOrSlice ¶
type StringOrSlice []string
func (StringOrSlice) MarshalJSON ¶
func (s StringOrSlice) MarshalJSON() ([]byte, error)
func (*StringOrSlice) UnmarshalJSON ¶
func (s *StringOrSlice) UnmarshalJSON(data []byte) error
Click to show internal directories.
Click to hide internal directories.