Skip to content

Commit

Permalink
inject the Authentication handler to override the anonymous handler t…
Browse files Browse the repository at this point in the history
…hat gets injected by default (elsa-workflows#3139)

(cherry picked from commit f861bf8)

Co-authored-by: Rojan Ulak <[email protected]>
  • Loading branch information
r-ulak and Rojan Ulak authored Jun 21, 2022
1 parent 7312b6f commit bab82b5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/samples/aspnet/Elsa.Samples.HttpEndpointSecurity/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.IdentityModel.Tokens.Jwt;
using System.Text;
using Elsa.Activities.Http.Services;
using Elsa.Samples.HttpEndpointSecurity.Options;
using Elsa.Samples.HttpEndpointSecurity.Services;
using Microsoft.AspNetCore.Authentication.JwtBearer;
Expand Down Expand Up @@ -61,8 +63,15 @@ public void ConfigureServices(IServiceCollection services)
// Elsa.
services
.AddElsa(elsa => elsa
.AddHttpActivities(http => Configuration.GetSection("Elsa:Server").Bind(http))
.AddWorkflowsFrom<Startup>()
.AddHttpActivities(http =>

{
http.HttpEndpointAuthorizationHandlerFactory =
ActivatorUtilities.GetServiceOrCreateInstance<AuthenticationBasedHttpEndpointAuthorizationHandler>;
http.BaseUrl = new Uri(Configuration["Elsa:Server:BaseUrl"]);
http.BasePath = Configuration["Elsa:Server:BasePath"];
}
).AddWorkflowsFrom<Startup>()
);

// Application Services.
Expand Down

0 comments on commit bab82b5

Please sign in to comment.