Documentation
¶
Index ¶
- func ParseJWTSegment(segment []byte, v any) error
- func RequireOlder(t1, t2 []byte) error
- func SameIdentity(t1, t2 []byte) error
- func SplitCompact(src []byte) ([]byte, []byte, []byte, error)
- type Jws
- type Jwt
- type OidcClaims
- type ProtectedClaims
- type SigOptStruct
- type SigOpts
- type Signature
- type Tokens
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseJWTSegment ¶
func RequireOlder ¶
RequireOlder returns an error if t1 is not older than t2
func SameIdentity ¶
Compares two JWTs and determines if they are for the same identity (subject)
func SplitCompact ¶
SplitCompact splits a JWT and returns its three parts separately: protected headers, payload and signature. This is copied from github.com/lestrrat-go/jwx/v2/jws.SplitCompact We include it here so so that jwx is not a dependency of simpleJws
Types ¶
type Jws ¶
type Jwt ¶
type Jwt struct {
// contains filtered or unexported fields
}
func (*Jwt) GetClaims ¶
func (i *Jwt) GetClaims() *OidcClaims
func (*Jwt) GetPayload ¶
func (*Jwt) GetSignature ¶
type OidcClaims ¶
type OidcClaims struct {
Issuer string `json:"iss"`
Subject string `json:"sub"`
Audience string `json:"-"`
Expiration int64 `json:"exp"`
IssuedAt int64 `json:"iat"`
Email string `json:"email,omitempty"`
Nonce string `json:"nonce,omitempty"`
Username string `json:"preferred_username,omitempty"`
FirstName string `json:"given_name,omitempty"`
LastName string `json:"family_name,omitempty"`
}
func (*OidcClaims) UnmarshalJSON ¶
func (id *OidcClaims) UnmarshalJSON(data []byte) error
Implement UnmarshalJSON for custom handling during JSON unmarshalling
type ProtectedClaims ¶
type SigOptStruct ¶
type SigOpts ¶
type SigOpts func(a *SigOptStruct)
func WithPublicHeader ¶
WithPublicHeader species that a public header be included in the signature. Public headers aren't Base64 encoded because they aren't signed. Example use: WithPublicHeader(map[string]any{"key1": "abc", "key2": "def"})
type Signature ¶
type Signature struct {
Protected string `json:"protected"` // Base64 encoded
Public map[string]interface{} `json:"header,omitempty"`
Signature string `json:"signature"` // Base64 encoded
// contains filtered or unexported fields
}
func (*Signature) GetProtectedClaims ¶
func (s *Signature) GetProtectedClaims() *ProtectedClaims