mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-26 02:08:29 +02:00
Add support for AzureAD authentication for REST admin interface (#637)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using WireMock.Matchers;
|
||||
|
||||
namespace WireMock.Authentication
|
||||
{
|
||||
internal class BasicAuthenticationMatcher : RegexMatcher
|
||||
{
|
||||
public BasicAuthenticationMatcher(string username, string password) : base(BuildPattern(username, password))
|
||||
{
|
||||
}
|
||||
|
||||
public override string Name => nameof(BasicAuthenticationMatcher);
|
||||
|
||||
private static string BuildPattern(string username, string password)
|
||||
{
|
||||
return "^(?i)BASIC " + Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password)) + "$";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user