-
Notifications
You must be signed in to change notification settings - Fork 40
Closed
Labels
app: runnerConcerns the RunnerConcerns the Runnertype: enhancementNew feature or requestNew feature or request
Description
I couldn't get authentication to work with Azure AD B2C.
Upon looking at the code, we are using IdentityModel in the OAuth2TokenManager.
Unfortunately following line doesn't work with Azure AD B2C. discoveryDocument
is going to contain an error.
var discoveryDocument =
await this.HttpClient.GetDiscoveryDocumentAsync(oauthProperties.Authority.ToString(), cancellationToken);
The error is, Endpoint belongs to different authority
which is getting thrown from IdentityModel library.
And because of that, discoveryDocument.TokenEndpoint
is going to be null here.
using var request = new HttpRequestMessage(HttpMethod.Post, new Uri(oauthProperties.Authority, discoveryDocument.TokenEndpoint))
{
Content = new FormUrlEncodedContent(properties)
};
We can get past that error when using IdentityModel by doing something like below,
DiscoveryDocumentResponse discoveryDocument
= await httpClient.GetDiscoveryDocumentAsync(new DiscoveryDocumentRequest
{
Address = "https://login.microsoftonline.com/<TenantId>/v2.0",
Policy = new DiscoveryPolicy
{
AdditionalEndpointBaseAddresses =
{
"https://login.microsoftonline.com/<TenantId>",
"https://graph.microsoft.com/oidc/userinfo"
}
}
});
But OAuth2TokenManager
isn't extendable.
Metadata
Metadata
Assignees
Labels
app: runnerConcerns the RunnerConcerns the Runnertype: enhancementNew feature or requestNew feature or request