jwks

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RSAAlgorithm       = "RSA"
	RSAExponentAQAB    = "AQAB"
	RSAExponentAAEAAQ  = "AAEAAQ"
	RSADefaultExponent = 65537
)

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONKey

type JSONKey struct {
	E   string `json:"e"`   // Exponent of the RSA public key.
	Kid string `json:"kid"` // Key ID used to match a specific key.
	Kty string `json:"kty"` // Key type (e.g., "RSA").
	N   string `json:"n"`   // Modulus of the RSA public key.
}

JSONKey represents a single JSON Web Key (JWK) with RSA key parameters.

type JWKS

type JWKS struct {
	Keys []JSONKey `json:"keys"` // List of JSON Web Keys.
}

JWKS represents a JSON Web Key Set (JWKS) containing multiple JSONKey entries.

func (JWKS) DoGetJWKS

func (j JWKS) DoGetJWKS(_ context.Context) Manager

DoGetJWKS return package interface

func (JWKS) GetJWKSRSAKeys

func (j JWKS) GetJWKSRSAKeys(awsRegion, poolID string) (map[string]string, error)

GetJWKSRSAKeys retrieves the JWKS RSA keys which are consumed by the authorisation middleware on startup.

func (JWKS) JWKSGetKeyset

func (j JWKS) JWKSGetKeyset(awsRegion, poolID string) (*JWKS, error)

JWKSGetKeyset primary package method which retrives the json web key set for cognito user pool

func (JWKS) JWKSToRSA

func (j JWKS) JWKSToRSA(jwks *JWKS) (map[string]string, error)

JWKSToRSA method returns a map of the JWKS RSA Public keys

func (JWKS) JWKSToRSAJSONResponse

func (j JWKS) JWKSToRSAJSONResponse(jwks *JWKS) ([]byte, error)

JWKSToRSAJSONResponse method returns byte[] array for request response

func (JWKS) JWKToRSAPublicKey

func (j JWKS) JWKToRSAPublicKey(jwk JSONKey) (string, error)

JWKToRSAPublicKey transforms key data to PKIX, ASN.1 DER form

type Manager

type Manager interface {
	// JWKSGetKeyset retrieves the JWKS for the specified AWS region and user pool ID.
	JWKSGetKeyset(awsRegion, poolID string) (*JWKS, error)

	// JWKSToRSAJSONResponse formats the JWKS as an RSA JSON response.
	JWKSToRSAJSONResponse(jwks *JWKS) ([]byte, error)
}

Manager defines methods for managing JSON Web Key Sets (JWKS). It provides domain-specific methods to retrieve and format JWKS data and serves the purpose of maintaining explicit, domain-specific naming that aligns with the rest of the system.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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