Skip to content

Commit 9f90a73

Browse files
Enabling server certificate validation
1 parent ca8ddb9 commit 9f90a73

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

docs/authentication.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ Before using the provided `-AccessToken` to get Microsoft Graph resources, custo
114114

115115
### Access Token Proof of Possession (AT PoP)
116116

117-
AT PoP is a security mechanism that binds an access token to a cryptographic key that only the intended recipient has. This prevents unauthorized use of the token by malicious actors. AT PoP enhances data protection, reduces token replay attacks, and enables fine-grained authorization policies.
117+
AT PoP is a security mechanism that binds an access token to a cryptographic key that only the token requestor has. This prevents unauthorized use of the token by malicious actors. AT PoP enhances data protection, reduces token replay attacks, and enables fine-grained authorization policies.
118118

119-
Note: AT PoP requires WAM to function.
119+
Note: AT PoP requires Web Account Manager (WAM) to function.
120120

121121
Microsoft Graph PowerShell module supports AT PoP in the following scenario:
122122

src/Authentication/Authentication.Core/Utilities/AuthenticationHelpers.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ public static PopTokenRequestContext CreatePopTokenRequestContext(IAuthContext a
482482
{
483483
// Creating a httpclient that would handle all pop calls
484484
Uri popResourceUri = GraphSession.Instance.GraphRequestProofofPossession.Uri ?? new Uri("https://canary.graph.microsoft.com/beta/me"); //PPE (https://graph.microsoft-ppe.com) or Canary (https://canary.graph.microsoft.com) or (https://20.190.132.47/beta/me)
485-
HttpClient popHttpClient = new(new HttpClientHandler { ServerCertificateCustomValidationCallback = (_, _, _, _) => true });
485+
HttpClient popHttpClient = new(new HttpClientHandler());
486486

487487
// Find the WWW-Authenticate header in the response.
488488
var popMethod = GraphSession.Instance.GraphRequestProofofPossession.HttpMethod ?? HttpMethod.Get;
@@ -498,7 +498,7 @@ public static PopTokenRequestContext CreatePopTokenRequestContext(IAuthContext a
498498

499499
});
500500

501-
var _popPipeline = HttpPipelineBuilder.Build(popPipelineOptions, new HttpPipelineTransportOptions { ServerCertificateCustomValidationCallback = (_) => true });
501+
var _popPipeline = HttpPipelineBuilder.Build(popPipelineOptions, new HttpPipelineTransportOptions());
502502
GraphSession.Instance.GraphRequestProofofPossession.Request = _popPipeline.CreateRequest();
503503
GraphSession.Instance.GraphRequestProofofPossession.Request.Method = ConvertToAzureRequestMethod(popMethod);
504504
GraphSession.Instance.GraphRequestProofofPossession.Request.Uri.Reset(popResourceUri);

src/Authentication/Authentication.Test/Microsoft.Graph.Authentication.Test.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.2" />
99
<!-- As described in this post https://devblogs.microsoft.com/powershell/depending-on-the-right-powershell-nuget-package-in-your-net-project, reference the SDK for dotnetcore-->
1010
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.2.2" PrivateAssets="all" Condition="'$(TargetFramework)' == 'net6.0'" />
11-
<PackageReference Include="Moq" Version="4.20.69" />
11+
<PackageReference Include="Moq" Version="4.20.1" />
1212
<PackageReference Include="xunit" Version="2.4.2" />
1313
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
1414
<PrivateAssets>all</PrivateAssets>

src/Authentication/Authentication/test/Get-MgGraphOption.Tests.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Describe "Get-MgGraphOption Command" {
1313
$GetMgGraphOptionCommand = Get-Command Set-MgGraphOption
1414
$GetMgGraphOptionCommand | Should -Not -BeNullOrEmpty
1515
$GetMgGraphOptionCommand.ParameterSets | Should -HaveCount 1
16-
$GetMgGraphOptionCommand.ParameterSets.Parameters | Should -HaveCount 13 # PS common parameters.
16+
$GetMgGraphOptionCommand.ParameterSets.Parameters | Should -HaveCount 14 # PS common parameters.
1717
}
1818

1919
It 'Executes successfully' {

src/Authentication/Authentication/test/Set-MgGraphOption.Tests.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Describe "Set-MgGraphOption" {
1313
$SetMgGraphOptionCommand = Get-Command Set-MgGraphOption
1414
$SetMgGraphOptionCommand | Should -Not -BeNullOrEmpty
1515
$SetMgGraphOptionCommand.ParameterSets | Should -HaveCount 1
16-
$SetMgGraphOptionCommand.ParameterSets.Parameters | Should -HaveCount 13 # PS common parameters.
16+
$SetMgGraphOptionCommand.ParameterSets.Parameters | Should -HaveCount 14 # PS common parameters.
1717
}
1818

1919
It 'Executes successfully when toggling WAM on' {

0 commit comments

Comments
 (0)