Skip to content

Commit 0823303

Browse files
authored
Fix PopTokenRequestContext ctor (Azure#43789)
1 parent 3291fcd commit 0823303

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

sdk/core/Azure.Core.Experimental/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
### Bugs Fixed
1010

11+
- Fixed a bug in the `PopTokenRequestContext` constructor that caused the `IsProofOfPossessionEnabled` property to be ignored.
12+
1113
### Other Changes
1214

1315
## 0.1.0-preview.33 (2024-04-04)

sdk/core/Azure.Core.Experimental/src/PopTokenRequestContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public PopTokenRequestContext(string[] scopes, string? parentRequestId = default
3030
TenantId = tenantId;
3131
IsCaeEnabled = isCaeEnabled;
3232
ProofOfPossessionNonce = proofOfPossessionNonce;
33+
IsProofOfPossessionEnabled = isProofOfPossessionEnabled;
3334
_request = request;
3435
}
3536

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System;
5+
using System.Net.Http;
6+
using Azure.Core;
7+
using Azure.Core.TestFramework;
8+
using NUnit.Framework;
9+
10+
namespace Azure
11+
{
12+
public class PopTokenRequestContextTests
13+
{
14+
[Test]
15+
public void PopTokenRequestContextCtor()
16+
{
17+
var scopes = new string[] { "scope1", "scope2" };
18+
var parentRequestId = Guid.NewGuid().ToString();
19+
var claims = "claims";
20+
var tenantId = Guid.NewGuid().ToString();
21+
var isCaeEnabled = true;
22+
var isProofOfPossessionEnabled = true;
23+
var proofOfPossessionNonce = Guid.NewGuid().ToString();
24+
var request = new MockRequest();
25+
request.Method = RequestMethod.Get;
26+
request.Uri.Reset(new Uri("http://example.com"));
27+
28+
var context = new PopTokenRequestContext(scopes, parentRequestId, claims, tenantId, isCaeEnabled, isProofOfPossessionEnabled, proofOfPossessionNonce, request);
29+
30+
Assert.AreEqual(scopes, context.Scopes);
31+
Assert.AreEqual(parentRequestId, context.ParentRequestId);
32+
Assert.AreEqual(claims, context.Claims);
33+
Assert.AreEqual(tenantId, context.TenantId);
34+
Assert.AreEqual(isCaeEnabled, context.IsCaeEnabled);
35+
Assert.AreEqual(isProofOfPossessionEnabled, context.IsProofOfPossessionEnabled);
36+
Assert.AreEqual(proofOfPossessionNonce, context.ProofOfPossessionNonce);
37+
Assert.AreEqual(new HttpMethod(request.Method.ToString()), context.HttpMethod);
38+
Assert.AreEqual(request.Uri.ToUri(), context.Uri);
39+
}
40+
}
41+
}

0 commit comments

Comments
 (0)