jose

package
v0.0.0-...-776d397 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSigningKeys

func GenerateSigningKeys(id, alg string, bits int) (*jose.JSONWebKeySet, error)

GenerateSigningKeys generates a JSON Web Key Set for signing.

func GenerateSigningKeysAvailableAlgorithms

func GenerateSigningKeysAvailableAlgorithms() []string

GenerateSigningKeysAvailableAlgorithms lists available algorithms that are supported by GenerateSigningKeys.

func LoadJSONWebKey

func LoadJSONWebKey(json []byte, pub bool) (*jose.JSONWebKey, error)

LoadJSONWebKey returns a *jose.JSONWebKey for a given JSON string.

func LoadPrivateKey

func LoadPrivateKey(data []byte) (interface{}, error)

LoadPrivateKey loads a private key from PEM/DER/JWK-encoded data.

func LoadPublicKey

func LoadPublicKey(data []byte) (interface{}, error)

LoadPublicKey loads a public key from PEM/DER/JWK-encoded data.

Types

type Claims

type Claims struct {
	// Audience identifies the recipients that the JWT is intended for.
	Audience []string `json:"aud"`

	// Issuer identifies the principal that issued the JWT.
	Issuer string `json:"iss"`

	// Subject identifies the principal that is the subject of the JWT.
	Subject string `json:"sub"`

	// ExpiresAt identifies the expiration time on or after which the JWT most not be accepted for processing.
	ExpiresAt time.Time `json:"exp"`

	// IssuedAt identifies the time at which the JWT was issued.
	IssuedAt time.Time `json:"iat"`

	// NotBefore identifies the time before which the JWT must not be accepted for processing.
	NotBefore time.Time `json:"nbf"`

	// JTI provides a unique identifier for the JWT.
	JTI string `json:"jti"`
}

Claims represents a JSON Web Token's standard claims.

func ParseMapInterfaceInterfaceClaims

func ParseMapInterfaceInterfaceClaims(claims map[interface{}]interface{}) *Claims

ParseMapInterfaceInterfaceClaims converts map[interface{}]interface{} to *Claims.

func ParseMapStringInterfaceClaims

func ParseMapStringInterfaceClaims(claims map[string]interface{}) *Claims

ParseMapStringInterfaceClaims converts map[string]interface{} to *Claims.

type Fetcher

type Fetcher struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Fetcher is a small helper for fetching JSON Web Keys from remote endpoints.

func NewFetcher

func NewFetcher(remote string) *Fetcher

NewFetcher returns a new fetcher that can download JSON Web Keys from remote endpoints.

func (*Fetcher) GetKey

func (f *Fetcher) GetKey(kid string) (*jose.JSONWebKey, error)

GetKey retrieves a JSON Web Key from the cache, fetches it from a remote if it is not yet cached or returns an error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL