Skip to content

Commit

Permalink
Fix TypeLoadException (#4792)
Browse files Browse the repository at this point in the history
* Fix

* attribute
  • Loading branch information
bgavrilMS committed Jun 3, 2024
1 parent 239d9d6 commit 5c6f22f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@

namespace Microsoft.Identity.Client.Extensibility
{

/// <summary>
/// Extensions for all AcquireToken methods
/// </summary>
public static partial class AbstractConfidentialClientAcquireTokenParameterBuilderExtension
public static class AbstractConfidentialClientAcquireTokenParameterBuilderExtension
{
/// <summary>
/// Intervenes in the request pipeline, by executing a user provided delegate before MSAL makes the token request.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.ComponentModel;

namespace Microsoft.Identity.Client.Extensibility
{
/// <summary>
///
/// </summary>
public static class AcquireTokenForClientBuilderExtensions
{
/// <summary>
/// Binds the token to a key in the cache. L2 cache keys contain the key id.
/// No cryptographic operations is performed on the token.
/// </summary>
/// <param name="builder"></param>
/// <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>
/// <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>
/// <returns>the builder</returns>
[EditorBrowsable(EditorBrowsableState.Never)] // https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/4789
public static AcquireTokenForClientParameterBuilder WithProofOfPosessionKeyId(
this AcquireTokenForClientParameterBuilder builder,
string keyId,
string expectedTokenTypeFromAad = "Bearer")
{
if (string.IsNullOrEmpty(keyId))
{
throw new ArgumentNullException(nameof(keyId));
}

builder.ValidateUseOfExperimentalFeature();
builder.CommonParameters.AuthenticationScheme = new ExternalBoundTokenScheme(keyId, expectedTokenTypeFromAad);

return builder;
}
}
}

0 comments on commit 5c6f22f

Please sign in to comment.