* Simplify test setup by removing `Input` wrapper and fix trimming warnings with `UnconditionalSuppressMessage` annotations. * Add trimming warning suppression to `ArgumentJsonConverter` with `UnconditionalSuppressMessage` - Annotated `Read` method to suppress `IL2055` warning caused by dynamic type resolution. - Provided justification reflecting dynamic type registration in the well-known type registry. * Add root namespace to project file and suppress EF Core usage warning - Added `RootNamespace` property to `Elsa.Persistence.EFCore.Common.csproj` for consistency. - Annotated `DbSchemaAwareMigrationAssembly` with `SuppressMessage` to suppress EF1001 usage warning and provide justification. * Suppress obsolete API warnings in workflow runtime projects - Added `#pragma warning disable CS0618` to suppress obsolete member warnings in `ObsoleteWorkflowRuntime.cs`, `LocalWorkflowRuntime.Obsolete.cs`, and `DistributedWorkflowRuntime.Obsolete.cs`. - Updated `Directory.Build.props` to globally suppress `CS0618` for backward compatibility during migration. * Annotate properties with non-nullable default initializers across modules to enforce null safety. * Add `Priority` and `Deprecated` properties to `StorageDriverDescriptor` model * Update src/modules/Elsa.Workflows.Runtime.Distributed/Services/DistributedWorkflowRuntime.Obsolete.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/modules/Elsa.Workflows.Runtime/Services/ObsoleteWorkflowRuntime.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/modules/Elsa.Workflows.Runtime/Services/LocalWorkflowRuntime.Obsolete.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Clean up XML comments and improve consistency across modules. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using Elsa.Features.Services;
|
|
using Elsa.Identity.Features;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
namespace Elsa.Extensions;
|
|
|
|
/// <summary>
|
|
/// Extensions for <see cref="IModule"/> that installs the <see cref="IdentityFeature"/> feature.
|
|
/// </summary>
|
|
public static class ModuleExtensions
|
|
{
|
|
/// <summary>
|
|
/// Installs and configures the <see cref="IdentityFeature"/> feature.
|
|
/// </summary>
|
|
public static IModule UseIdentity(this IModule module, Action<IdentityFeature>? configure = null)
|
|
{
|
|
module.Configure(configure);
|
|
return module;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Installs and configures the <see cref="IdentityFeature"/> feature.
|
|
/// </summary>
|
|
public static IModule UseIdentity(this IModule module, string signingKey, string issuer = "http://elsa.api", string audience = "http://elsa.api", TimeSpan? tokenLifetime = null)
|
|
{
|
|
module.UseIdentity(identity => identity.TokenOptions += options =>
|
|
{
|
|
options.Audience = audience;
|
|
options.Issuer = issuer;
|
|
options.AccessTokenLifetime = tokenLifetime ?? TimeSpan.FromHours(1);
|
|
options.SigningKey = signingKey;
|
|
});
|
|
return module;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Installs and configures the <see cref="DefaultAuthenticationFeature"/> feature.
|
|
/// </summary>
|
|
public static IModule UseDefaultAuthentication(this IModule module, Action<DefaultAuthenticationFeature>? configure = null)
|
|
{
|
|
module.Configure(configure);
|
|
return module;
|
|
}
|
|
} |