Documentation
¶
Overview ¶
Copyright 2014 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrProofMissing = errors.New("dpop: HTTP Header '" + httpHeader + "' not present in request") ErrProofMalformedHeader = errors.New(`dpop: HTTP Header '` + httpHeader + `' contained a malformed JWT header`) ErrProofMalformedClaim = errors.New(`dpop: HTTP Header '` + httpHeader + `' contained a malformed JWT claim`) ErrProofInvalidSignature = errors.New(`dpop: HTTP Header '` + httpHeader + `' contained an invalid JWT`) )
Functions ¶
This section is empty.
Types ¶
type Proof ¶
type ProofClaims ¶
type ProofClaims struct { jwt.Claims HTTPMethod string `json:"htm,omitempty"` HTTPUri string `json:"htu,omitempty"` }
ProofClaims are common claims in the DPoP proof JWT.
type TokenExchange ¶
type Validator ¶
type Validator struct {
xjwt.VerifyConfig
}
ProofValidator validates DPoP proof headers
func (*Validator) ValidateResourceAccess ¶
func (pv *Validator) ValidateResourceAccess(req *http.Request, keyFingerprint string) (*ProofClaims, []byte, *jose.JSONWebKey, error)
ValidateResourceAccess parses and performs a PARTIAL validation of the DPoP proof JWT.
It returns common proof claims, raw claims, and the public JWK used to sign the proof.
keyFingerprint is the "jkt#S256" cnf claim from a JWT based Access Token or from an introspection response.
Callers MUST do additional validation for their use case of:
ProofClaims.JTI: For replay protection, confirm this JTI has not been used before: Within a reasonable consideration of accuracy and resource utilization, a JWT with the same "jti" value has not been received previously (see Section 9.1).
func (*Validator) ValidateTokenRequest ¶
func (pv *Validator) ValidateTokenRequest(req *http.Request) (*ProofClaims, []byte, *jose.JSONWebKey, error)
ValidateTokenRequest parses and performs a PARTIAL validation of the DPoP proof JWT.
It returns common proof claims, raw claims, and the public JWK used to sign the proof.
Callers MUST do additional validation for their use case of:
ProofClaims.JTI: For replay protection, confirm this JTI has not been used before: Within a reasonable consideration of accuracy and resource utilization, a JWT with the same "jti" value has not been received previously (see Section 9.1). JSONWebKey: The caller must calculate the JWK SHA-256 Thumbprint, encoding it using base64url, and embed it in any Access Tokens issued or make it available in the introspection request: tb, err := key.Thumbprint(crypto.SHA256) cnfThumbprint := base64.URLEncoding.EncodeToString(tb) JSONWebKey: Algorithm and key type are acceptable.
If this Client has previously used a DPoP binding at Token request, you may also wish to restrict the JSONWebKey to a previously used value.