Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public AzureADOpenIdConnectOptionsConfiguration(IOptions<AzureADSchemeOptions> s
public void Configure(string name, OpenIdConnectOptions options)
{
var azureADScheme = GetAzureADScheme(name);
if (azureADScheme is null)
{
return;
}

var azureADOptions = _azureADOptions.Get(azureADScheme);
if (name != azureADOptions.OpenIdConnectSchemeName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,5 +485,25 @@ public void AddAzureADBearer_SkipsOptionsValidationForNonAzureCookies()

Assert.NotNull(jwtOptions.Get("other"));
}

[Fact]
public void AddAzureAD_SkipsOptionsValidationForNonAzureOpenIdConnect()
{
var services = new ServiceCollection();
services.AddSingleton<ILoggerFactory>(new NullLoggerFactory());

services.AddAuthentication()
.AddAzureAD(o => { })
.AddOpenIdConnect("other", null, o =>
{
o.ClientId = "ClientId";
o.Authority = "https://authority.com";
});

var provider = services.BuildServiceProvider();
var openIdConnectOptions = provider.GetService<IOptionsMonitor<OpenIdConnectOptions>>();

Assert.NotNull(openIdConnectOptions.Get("other"));
}
}
}