-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add client certificates collection to HttpRequestData (#2462)
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
test/Microsoft.IdentityModel.Protocols.Tests/HttpRequestDataTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using System.Security.Cryptography.X509Certificates; | ||
using Microsoft.IdentityModel.TestUtils; | ||
using Xunit; | ||
|
||
namespace Microsoft.IdentityModel.Protocols.Tests | ||
{ | ||
public class HttpRequestDataTests | ||
{ | ||
[Fact] | ||
public void ClientCertificates() | ||
{ | ||
var httpRequestData = new HttpRequestData(); | ||
Assert.NotNull(httpRequestData.ClientCertificates); | ||
Assert.Empty(httpRequestData.ClientCertificates); | ||
|
||
var cert = new X509Certificate2(Convert.FromBase64String(KeyingMaterial.AADCertData)); | ||
httpRequestData.ClientCertificates.Add(cert); | ||
|
||
Assert.Single(httpRequestData.ClientCertificates); | ||
Assert.Equal(cert, httpRequestData.ClientCertificates[0]); | ||
} | ||
} | ||
} |