dpop

package
v6.2.13 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ATHKey is the claim key of the ath JWT claim for a DPoP token
	ATHKey = "ath"
	// DPopType is the value of the typ JWT header for a DPoP token
	DPopType = "dpop+jwt"
	HTMKey   = "htm"
	HTUKey   = "htu"
)

Variables

View Source
var ErrInvalidDPoP = errors.New("invalid DPoP token")

ErrInvalidDPoP is returned when a DPoP token is invalid

Functions

This section is empty.

Types

type DPoP

type DPoP struct {
	Headers jws.Headers `json:"-"`
	Kid     string      `json:"-"`
	Token   jwt.Token   `json:"-"`
	// contains filtered or unexported fields
}

DPoP represents a DPoP token used for internal processing

func New

func New(request http.Request) *DPoP

New creates a new DPoP token from the given http request

func Parse

func Parse(s string) (*DPoP, error)

Parse parses a DPoP token from a string. The token is validated for the required claims and headers.

func (DPoP) GenerateProof

func (t DPoP) GenerateProof(accessToken string) DPoP

GenerateProof generates the proof for the DPoP token It sets the ath claim to the base64 encoded SHA256 hash of the access token

func (DPoP) HTM

func (t DPoP) HTM() string

HTM returns the htm claim of the DPoP token

func (DPoP) HTU

func (t DPoP) HTU() string

HTU returns the htu claim of the DPoP token

func (DPoP) MarshalJSON

func (t DPoP) MarshalJSON() ([]byte, error)

func (DPoP) Match

func (t DPoP) Match(jkt string, method string, url string) (bool, error)

Match checks if the JWK, http method, domain and path of the DPoP tokens match for the url, the port is stripped. If there is a mismatch, the reason is returned in an error.

func (*DPoP) Sign

func (t *DPoP) Sign(kid string, key crypto.Signer, alg jwa.SignatureAlgorithm) (string, error)

Sign the DPoP token with the given key It also adds the jwk and alg header

func (DPoP) String

func (t DPoP) String() string

func (*DPoP) UnmarshalJSON

func (t *DPoP) UnmarshalJSON(bytes []byte) error

Jump to

Keyboard shortcuts

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