mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	messing around on mac trying to get something working..
This commit is contained in:
		@@ -102,7 +102,8 @@ namespace Ocelot.Authentication.Middleware
 | 
			
		||||
                //auth.AddScheme(scheme);
 | 
			
		||||
 | 
			
		||||
                //todo - call the next middleware to authenticate? Does this need to be on a different branch so it doesnt call any further middlewares?
 | 
			
		||||
                var result = await context.AuthenticateAsync(DownstreamRoute.ReRoute.AuthenticationOptions.Provider);
 | 
			
		||||
                var scheme = await auth.GetSchemeAsync("IdentityServer");
 | 
			
		||||
                var result = await context.AuthenticateAsync("IdentityServer");
 | 
			
		||||
                context.User = result.Principal;
 | 
			
		||||
 | 
			
		||||
                if (context.User.Identity.IsAuthenticated)
 | 
			
		||||
 
 | 
			
		||||
@@ -150,27 +150,20 @@ namespace Ocelot.DependencyInjection
 | 
			
		||||
            {
 | 
			
		||||
                services.AddIdentityServer(identityServerConfiguration, configurationRoot);
 | 
			
		||||
            }
 | 
			
		||||
            services.AddSingleton(services);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            Action<AuthenticationSchemeBuilder> builder = schemeBuilder =>
 | 
			
		||||
            // public static IServiceCollection AddScheme<TOptions, THandler>(this IServiceCollection services, string authenticationScheme, Action<TOptions> configureOptions)
 | 
			
		||||
            Action<IdentityServerAuthenticationOptions> options = o =>
 | 
			
		||||
            {
 | 
			
		||||
                
 | 
			
		||||
            } 
 | 
			
		||||
                o.Authority = "http://localhost:51888";
 | 
			
		||||
                o.ApiName = "api";
 | 
			
		||||
                o.RequireHttpsMetadata = false;
 | 
			
		||||
                o.SupportedTokens = SupportedTokens.Both;
 | 
			
		||||
                o.ApiSecret = "secret";
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            services.AddAuthentication(x =>
 | 
			
		||||
                {
 | 
			
		||||
                    x.AddScheme("", );
 | 
			
		||||
                })
 | 
			
		||||
                .AddIdentityServerAuthentication(o =>
 | 
			
		||||
                {
 | 
			
		||||
                    o.Authority = "http://localhost:51888";
 | 
			
		||||
                    o.ApiName = "api";
 | 
			
		||||
                    o.RequireHttpsMetadata = false;
 | 
			
		||||
                    o.SupportedTokens = SupportedTokens.Both;
 | 
			
		||||
                    o.ApiSecret = "secret";
 | 
			
		||||
                });
 | 
			
		||||
            services.AddScheme<IdentityServerAuthenticationOptions, IdentityServerAuthenticationHandler>("IdentityServer", "IdentityServer", options);
 | 
			
		||||
 | 
			
		||||
            services.AddScheme<IdentityServerAuthenticationOptions, IdentityServerAuthenticationHandler>("IdentityServerIdentityServerAuthenticationJwt", "IdentityServerIdentityServerAuthenticationJwt", options);
 | 
			
		||||
 | 
			
		||||
            return services;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user