using Elsa.Features.Abstractions;
using Elsa.Features.Attributes;
using Elsa.Features.Services;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.Identity.Features;
///
/// Provides an authorization feature that configures the system with JWT bearer authentication.
///
[DependsOn(typeof(IdentityFeature))]
public class DefaultAuthenticationFeature : FeatureBase
{
///
public DefaultAuthenticationFeature(IModule module) : base(module)
{
}
///
public override void Apply()
{
var identityFeature = Module.Configure();
var identityOptions = identityFeature.TokenOptions;
Services
.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(JwtBearerDefaults.AuthenticationScheme, identityOptions.ConfigureJwtBearerOptions);
}
}