@@ -40,7 +40,7 @@ public DPoPProof CreateProofToken(DPoPProofRequest request)
4040
4141 // jwk: representing the public key chosen by the client, in JSON Web Key (JWK) [RFC7517] format,
4242 // as defined in Section 4.1.3 of [RFC7515]. MUST NOT contain a private key.
43- object jwk ;
43+ Dictionary < string , object > jwk ;
4444 if ( string . Equals ( jsonWebKey . Kty , JsonWebAlgorithmsKeyTypes . EllipticCurve ) )
4545 {
4646 jwk = new Dictionary < string , object >
@@ -71,12 +71,12 @@ public DPoPProof CreateProofToken(DPoPProofRequest request)
7171 { JwtClaimTypes . JsonWebKey , jwk } ,
7272 } ;
7373
74- var payload = new Dictionary < string , object >
74+ var payload = new DPoPProofPayload
7575 {
76- { JwtClaimTypes . JwtId , CryptoRandom . CreateUniqueId ( ) } ,
77- { JwtClaimTypes . DPoPHttpMethod , request . Method } ,
78- { JwtClaimTypes . DPoPHttpUrl , request . Url } ,
79- { JwtClaimTypes . IssuedAt , DateTimeOffset . UtcNow . ToUnixTimeSeconds ( ) } ,
76+ JwtId = CryptoRandom . CreateUniqueId ( ) ,
77+ DPoPHttpMethod = request . Method ,
78+ DPoPHttpUrl = request . Url ,
79+ IssuedAt = DateTimeOffset . UtcNow . ToUnixTimeSeconds ( )
8080 } ;
8181
8282 if ( ! string . IsNullOrWhiteSpace ( request . AccessToken ) )
@@ -87,17 +87,17 @@ public DPoPProof CreateProofToken(DPoPProofRequest request)
8787 var hash = sha256 . ComputeHash ( Encoding . ASCII . GetBytes ( request . AccessToken ) ) ;
8888 var ath = Base64Url . Encode ( hash ) ;
8989
90- payload . Add ( JwtClaimTypes . DPoPAccessTokenHash , ath ) ;
90+ payload . DPoPAccessTokenHash = ath ;
9191 }
9292
9393 if ( ! string . IsNullOrEmpty ( request . DPoPNonce ) )
9494 {
95- payload . Add ( JwtClaimTypes . Nonce , request . DPoPNonce ! ) ;
95+ payload . Nonce = request . DPoPNonce ! ;
9696 }
9797
9898 var handler = new JsonWebTokenHandler ( ) { SetDefaultTimesOnTokenCreation = false } ;
9999 var key = new SigningCredentials ( jsonWebKey , jsonWebKey . Alg ) ;
100- var proofToken = handler . CreateToken ( JsonSerializer . Serialize ( payload ) , key , header ) ;
100+ var proofToken = handler . CreateToken ( JsonSerializer . Serialize ( payload , SourceGenerationContext . Default . DPoPProofPayload ) , key , header ) ;
101101
102102 return new DPoPProof { ProofToken = proofToken ! } ;
103103 }
0 commit comments