Skip to content

Commit d5dac52

Browse files
Add check for alg
1 parent c720025 commit d5dac52

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/DPoP/DPoPProofTokenFactory.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,19 @@ public class DPoPProofTokenFactory
2424
public DPoPProofTokenFactory(string proofKey)
2525
{
2626
_jwk = new JsonWebKey(proofKey);
27+
28+
if (_jwk.Alg.IsNullOrEmpty())
29+
{
30+
throw new ArgumentException("alg must be set on proof key");
31+
}
2732
}
2833

2934
/// <summary>
3035
/// Creates a DPoP proof token.
3136
/// </summary>
3237
public DPoPProof CreateProofToken(DPoPProofRequest request)
3338
{
34-
var jsonWebKey = _jwk;// new JsonWebKey(request.DPoPJsonWebKey);
39+
var jsonWebKey = _jwk;
3540

3641
// jwk: representing the public key chosen by the client, in JSON Web Key (JWK) [RFC7517] format,
3742
// as defined in Section 4.1.3 of [RFC7515]. MUST NOT contain a private key.
@@ -62,7 +67,6 @@ public DPoPProof CreateProofToken(DPoPProofRequest request)
6267

6368
var header = new Dictionary<string, object>()
6469
{
65-
//{ "alg", "RS265" }, // JsonWebTokenHandler requires adding this itself
6670
{ "typ", JwtClaimTypes.JwtTypes.DPoPProofToken },
6771
{ JwtClaimTypes.JsonWebKey, jwk },
6872
};

0 commit comments

Comments
 (0)