mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-14 14:23:34 +01:00
* Update AzureADAuthenticationMatcher to support V2 Azure AAD tokens * fix ;-) * add tests * Update test/WireMock.Net.Tests/Authentication/MockJwtSecurityTokenHandler.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * . * WIREMOCK_AAD_TENANT * update logging * throw new SecurityTokenInvalidIssuerException($"tenant {extractedTenant} does not match {_tenant}."); --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
18 lines
647 B
C#
18 lines
647 B
C#
// Copyright © WireMock.Net
|
|
|
|
using System.IdentityModel.Tokens.Jwt;
|
|
using System.Security.Claims;
|
|
using Microsoft.IdentityModel.Tokens;
|
|
|
|
namespace WireMock.Net.Tests.Authentication;
|
|
|
|
internal class MockJwtSecurityTokenHandler : JwtSecurityTokenHandler
|
|
{
|
|
public override ClaimsPrincipal ValidateToken(string token, TokenValidationParameters validationParameters, out SecurityToken validatedToken)
|
|
{
|
|
validatedToken = new JwtSecurityToken();
|
|
var claims = new[] { new Claim(ClaimTypes.Name, "TestUser") };
|
|
var identity = new ClaimsIdentity(claims, "TestAuthType");
|
|
return new ClaimsPrincipal(identity);
|
|
}
|
|
} |