mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-12-20 11:05:49 +08:00
reorganised project so its a bit more vertical for features
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using IdentityServer4.AccessTokenValidation;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Library.Responses;
|
||||
|
||||
namespace Ocelot.Library.Authentication.Handler.Creator
|
||||
{
|
||||
using AuthenticationOptions = Configuration.AuthenticationOptions;
|
||||
|
||||
/// <summary>
|
||||
/// Cannot unit test things in this class due to use of extension methods
|
||||
/// </summary>
|
||||
public class AuthenticationHandlerCreator : IAuthenticationHandlerCreator
|
||||
{
|
||||
public Response<RequestDelegate> CreateIdentityServerAuthenticationHandler(IApplicationBuilder app, AuthenticationOptions authOptions)
|
||||
{
|
||||
var builder = app.New();
|
||||
|
||||
builder.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
|
||||
{
|
||||
Authority = authOptions.ProviderRootUrl,
|
||||
ScopeName = authOptions.ScopeName,
|
||||
RequireHttpsMetadata = authOptions.RequireHttps,
|
||||
AdditionalScopes = authOptions.AdditionalScopes,
|
||||
SupportedTokens = SupportedTokens.Both,
|
||||
ScopeSecret = authOptions.ScopeSecret
|
||||
});
|
||||
|
||||
var authenticationNext = builder.Build();
|
||||
|
||||
return new OkResponse<RequestDelegate>(authenticationNext);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user