Documentation ¶
Index ¶
- func Decode(tokenStr string, options DecodeOptions) (*identity.DockerIdentity, error)
- func Encode(identity identity.DockerIdentity, options EncodeOptions) (string, error)
- func FromContext(ctx context.Context) (string, bool)
- func IsExpired(tokenStr string, options DecodeOptions) (bool, error)
- func NewContext(ctx context.Context, token string) context.Context
- type DecodeOptions
- type EncodeOptions
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
func Decode(tokenStr string, options DecodeOptions) (*identity.DockerIdentity, error)
Decode decodes the given JWT string, returning the decoded identity.DockerIdentity
func Encode ¶
func Encode(identity identity.DockerIdentity, options EncodeOptions) (string, error)
Encode creates a JWT string for the given identity.DockerIdentity.
func FromContext ¶
FromContext returns the token value stored in ctx, if any.
Types ¶
type DecodeOptions ¶
DecodeOptions holds JWT decoding options
type EncodeOptions ¶
type EncodeOptions struct { // The token expiration time, represented as a UNIX timestamp Expiration int64 // The private key with which to sign the token SigningKey []byte // The x509 certificate associated with the signing key Certificate []byte // Identifier for the JWT. If this is empty, a random UUID will be generated. Jti string // Whether or not to include legacy claims that the gateways are still using to validate a JWT. IncludeLegacyClaims bool }
EncodeOptions holds JWT encoding options
type ValidationError ¶
type ValidationError struct {
VError *jwt.ValidationError
}
ValidationError interrogates the jwt.ValidationError, returning a more detailed error message.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Click to show internal directories.
Click to hide internal directories.