Documentation ¶
Overview ¶
Package jwx contains tools that deal with the various JWx (JOSE) technologies such as JWT, JWS, JWE, etc in Go.
JWS (https://tools.ietf.org/html/rfc7515) JWE (https://tools.ietf.org/html/rfc7516) JWK (https://tools.ietf.org/html/rfc7517) JWA (https://tools.ietf.org/html/rfc7518) JWT (https://tools.ietf.org/html/rfc7519)
The primary focus of this library tool set is to implement the extremely flexible OAuth2 / OpenID Connect protocols.
Examples are stored in a separate Go module (to avoid adding dependencies to this module), and thus does not appear in the online documentation for this module. You can find the examples in Github at https://github.com/lestrrat-go/jwx/examples
You can find more high level documentation at Github (https://github.com/lestrrat-go/jwx)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecoderSettings ¶ added in v1.0.6
func DecoderSettings(options ...JSONOption)
DecoderSettings gives you a access to configure the "encoding/json".Decoder used to decode JSON objects within the jwx framework.
Types ¶
type FormatKind ¶ added in v1.2.2
type FormatKind int
const ( UnknownFormat FormatKind = iota JWE JWS JWK JWKS JWT )
func GuessFormat ¶ added in v1.2.2
func GuessFormat(payload []byte) FormatKind
GuessFormat is used to guess the format the given payload is in using heuristics. See the type FormatKind for a full list of possible types.
This may be useful in determining your next action when you may encounter a payload that could either be a JWE, JWS, or a plain JWT.
Because JWTs are almost always JWS signed, you may be thrown off if you pass what you think is a JWT payload to this function. If the function is in the "Compact" format, it means it's a JWS signed message, and its payload is the JWT. Therefore this function will reuturn JWS, not JWT.
This function requires an extra parsing of the payload, and therefore may be inefficient if you call it every time before parsing.
func (FormatKind) String ¶ added in v1.2.2
func (i FormatKind) String() string
type JSONOption ¶ added in v1.0.6
type JSONOption interface { Option // contains filtered or unexported methods }
func WithUseNumber ¶ added in v1.0.6
func WithUseNumber(b bool) JSONOption
WithUseNumber controls whether the jwx package should unmarshal JSON objects with the "encoding/json".Decoder.UseNumber feature on.
Default is false.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
jwx
Module
|
|
internal
|
|
ecutil
Package ecutil defines tools that help with elliptic curve related computation
|
Package ecutil defines tools that help with elliptic curve related computation |
Package jwa defines the various algorithm described in https://tools.ietf.org/html/rfc7518
|
Package jwa defines the various algorithm described in https://tools.ietf.org/html/rfc7518 |
Package jwe implements JWE as described in https://tools.ietf.org/html/rfc7516
|
Package jwe implements JWE as described in https://tools.ietf.org/html/rfc7516 |
Package jwk implements JWK as described in https://tools.ietf.org/html/rfc7517
|
Package jwk implements JWK as described in https://tools.ietf.org/html/rfc7517 |
Package jws implements the digital signature on JSON based data structures as described in https://tools.ietf.org/html/rfc7515 If you do not care about the details, the only things that you would need to use are the following functions: jws.Sign(payload, algorithm, key) jws.Verify(encodedjws, algorithm, key) To sign, simply use `jws.Sign`.
|
Package jws implements the digital signature on JSON based data structures as described in https://tools.ietf.org/html/rfc7515 If you do not care about the details, the only things that you would need to use are the following functions: jws.Sign(payload, algorithm, key) jws.Verify(encodedjws, algorithm, key) To sign, simply use `jws.Sign`. |
Package jwt implements JSON Web Tokens as described in https://tools.ietf.org/html/rfc7519
|
Package jwt implements JSON Web Tokens as described in https://tools.ietf.org/html/rfc7519 |
openid
Package openid provides a specialized token that provides utilities to work with OpenID JWT tokens.
|
Package openid provides a specialized token that provides utilities to work with OpenID JWT tokens. |