You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
841 B
24 lines
841 B
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using System;
|
|
using Volo.Abp.Modularity;
|
|
|
|
namespace EShopOnAbp.Shared.Hosting.Microservices;
|
|
|
|
public static class JwtBearerConfigurationHelper
|
|
{
|
|
public static void Configure(
|
|
ServiceConfigurationContext context,
|
|
string audience)
|
|
{
|
|
var configuration = context.Services.GetConfiguration();
|
|
|
|
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
|
.AddJwtBearer(options =>
|
|
{
|
|
options.Authority = configuration["AuthServer:Authority"];
|
|
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
|
|
options.Audience = audience;
|
|
});
|
|
}
|
|
}
|