Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add audience to oidc provider options #202

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 4 additions & 2 deletions src/Esquio.UI.Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static async Task Main(string[] args)

var isAzureAd = builder.Configuration.GetValue<bool>("Security:IsAzureAd");
var authority = builder.Configuration.GetValue<string>("Security:Authority");
var audience = builder.Configuration.GetValue<string>("Security:Audience");
var clientId = builder.Configuration.GetValue<string>("Security:ClientId");
var scope = builder.Configuration.GetValue<string>("Security:Scope");
var responseType = builder.Configuration.GetValue<string>("Security:ResponseType");
Expand All @@ -53,10 +54,11 @@ public static async Task Main(string[] args)
options.ProviderOptions.ClientId = clientId;
options.ProviderOptions.ResponseType = responseType;
options.ProviderOptions.DefaultScopes.Add(scope);
options.ProviderOptions.AdditionalProviderParameters.Add(nameof(audience), audience);
});
}


builder.Services.AddAuthorizationCore(options =>
{
options.AddPolicy(Policies.Reader, builder => builder.AddRequirements(new PolicyRequirement(Policies.Reader)));
Expand All @@ -72,7 +74,7 @@ public static async Task Main(string[] args)
builder.Services.AddScoped<IAuthorizationHandler, PolicyRequirementHandler>();


var host = builder.Build();
var host = builder.Build();

var jsRuntime = builder.Services.BuildServiceProvider().GetRequiredService<IJSRuntime>();
await jsRuntime.InvokeVoidAsync("addAuthenticationScript", new object[] { isAzureAd });
Expand Down