Skip to content

Commit 5c6f22f

Browse files
authored
Fix TypeLoadException (#4792)
* Fix * attribute
1 parent 239d9d6 commit 5c6f22f

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

src/client/Microsoft.Identity.Client/Extensibility/AbstractConfidentialClientAcquireTokenParameterBuilderExtension.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77

88
namespace Microsoft.Identity.Client.Extensibility
99
{
10+
1011
/// <summary>
1112
/// Extensions for all AcquireToken methods
1213
/// </summary>
13-
public static partial class AbstractConfidentialClientAcquireTokenParameterBuilderExtension
14+
public static class AbstractConfidentialClientAcquireTokenParameterBuilderExtension
1415
{
1516
/// <summary>
1617
/// Intervenes in the request pipeline, by executing a user provided delegate before MSAL makes the token request.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System;
5+
using System.ComponentModel;
6+
7+
namespace Microsoft.Identity.Client.Extensibility
8+
{
9+
/// <summary>
10+
///
11+
/// </summary>
12+
public static class AcquireTokenForClientBuilderExtensions
13+
{
14+
/// <summary>
15+
/// Binds the token to a key in the cache. L2 cache keys contain the key id.
16+
/// No cryptographic operations is performed on the token.
17+
/// </summary>
18+
/// <param name="builder"></param>
19+
/// <param name="keyId">A key id to which the access token is associated. The token will not be retrieved from the cache unless the same key id is presented. Can be null.</param>
20+
/// <param name="expectedTokenTypeFromAad">AAD issues several types of bound tokens. MSAL checks the token type, which needs to match the value set by ESTS. Normal POP tokens have this as "pop"</param>
21+
/// <returns>the builder</returns>
22+
[EditorBrowsable(EditorBrowsableState.Never)] // https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/4789
23+
public static AcquireTokenForClientParameterBuilder WithProofOfPosessionKeyId(
24+
this AcquireTokenForClientParameterBuilder builder,
25+
string keyId,
26+
string expectedTokenTypeFromAad = "Bearer")
27+
{
28+
if (string.IsNullOrEmpty(keyId))
29+
{
30+
throw new ArgumentNullException(nameof(keyId));
31+
}
32+
33+
builder.ValidateUseOfExperimentalFeature();
34+
builder.CommonParameters.AuthenticationScheme = new ExternalBoundTokenScheme(keyId, expectedTokenTypeFromAad);
35+
36+
return builder;
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)