From 5f3cb70a3327618392f7320b4a62a0f3d0725263 Mon Sep 17 00:00:00 2001 From: Jason Konicki Date: Wed, 30 Oct 2019 10:39:36 -0400 Subject: [PATCH] Fixed formatting for code samples --- .../docs/steeltoe-circuitbreaker/index.html | 193 +++++------ .../docs/steeltoe-discovery/index.html | 318 +++++++++--------- .../wwwroot/docs/steeltoe-logging/index.html | 56 +-- .../docs/steeltoe-management/index.html | 277 ++++++++------- .../wwwroot/docs/steeltoe-security/index.html | 308 ++++++++--------- .../wwwroot/docs/steeltoe-smb/index.html | 10 +- 6 files changed, 594 insertions(+), 568 deletions(-) diff --git a/src/Client/wwwroot/docs/steeltoe-circuitbreaker/index.html b/src/Client/wwwroot/docs/steeltoe-circuitbreaker/index.html index 8517ef2..e2c486b 100644 --- a/src/Client/wwwroot/docs/steeltoe-circuitbreaker/index.html +++ b/src/Client/wwwroot/docs/steeltoe-circuitbreaker/index.html @@ -111,7 +111,7 @@
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.CircuitBreaker.HystrixCore" Version= "2.3.0"/>
+    <PackageReference Include="Steeltoe.CircuitBreaker.HystrixCore" Version= "2.3.0"/>
 ...
 </ItemGroup>
 
@@ -122,7 +122,7 @@
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.CircuitBreaker.Hystrix.MetricsEventsCore" Version= "2.3.0"/>
+    <PackageReference Include="Steeltoe.CircuitBreaker.Hystrix.MetricsEventsCore" Version= "2.3.0"/>
 ...
 </ItemGroup>
 
@@ -157,8 +157,8 @@
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.CircuitBreaker.Hystrix.MetricsStreamCore" Version= "2.3.0"/>
-					<PackageReference Include="RabbitMQ.Client" Version="5.0.1" />
+    <PackageReference Include="Steeltoe.CircuitBreaker.Hystrix.MetricsStreamCore" Version= "2.3.0"/>
+    <PackageReference Include="RabbitMQ.Client" Version="5.0.1" />
 ...
 </ItemGroup>
 
@@ -169,7 +169,7 @@
public class HelloWorldCommand : HystrixCommand<string>
 {
-					public HelloWorldCommand(string name)
+    public HelloWorldCommand(string name)
         : base(HystrixCommandGroupKeyDefault.AsKey("HelloWorldGroup"),
                 () => { return "Hello" + name; },
                 () => { return "Hello" + name + " via fallback"; })
@@ -188,20 +188,21 @@
 
 
public class HelloWorldCommand : HystrixCommand<string>
 {
-					private string _name;
-					public HelloWorldCommand(string name)
+    private string _name;
+    public HelloWorldCommand(string name)
         : base(HystrixCommandGroupKeyDefault.AsKey("HelloWorldGroup"))
     {
         _name = name;
     }
 
-					protected override async Task<string> RunAsync()
+    protected override async Task<string> RunAsync()
     {
-					return await Task.FromResult("Hello" + _name);
+        return await Task.FromResult("Hello" + _name);
     }
-					protected override async Task<string> RunFallbackAsync()
+
+    protected override async Task<string> RunFallbackAsync()
     {
-					return await Task.FromResult("Hello" + _name + " via fallback");
+        return await Task.FromResult("Hello" + _name + " via fallback");
     }
 }
 
@@ -733,25 +734,25 @@

The following example shows some Hystrix settings in JSON that configure the FortuneService command to use a thread pool with a name of FortuneServiceTPool.

{
-					"spring": {
-					"application": {
-					"name": "fortuneui"
+    "spring": {
+        "application": {
+            "name": "fortuneui"
+        }
+    },
+    "eureka": {
+        "client": {
+            "serviceUrl": "http://localhost:8761/eureka/",
+            "shouldRegisterWithEureka": false
+        }
+    },
+    "hystrix": {
+        "command": {
+            "FortuneService": {
+                "threadPoolKeyOverride": "FortuneServiceTPool"
+            }
+        }
     }
-  },
-					"eureka": {
-					"client": {
-					"serviceUrl": "http://localhost:8761/eureka/",
-					"shouldRegisterWithEureka": false
-    }
-  },
-					"hystrix": {
-					"command": {
-					"FortuneService": {
-					"threadPoolKeyOverride": "FortuneServiceTPool"
-      }
-    }
-  }
-  ...
+    ...
 }
 
@@ -771,20 +772,22 @@ public class Startup { ... - public IConfiguration Configuration { get; private set; } - public Startup(IConfiguration configuration) + public IConfiguration Configuration { get; private set; } + + public Startup(IConfiguration configuration) { Configuration = configuration; } - public void ConfigureServices(IServiceCollection services) + + public void ConfigureServices(IServiceCollection services) { - // Add Steeltoe Discovery Client service + // Add Steeltoe Discovery Client service services.AddDiscoveryClient(Configuration); - // Add Hystrix command FortuneService to Hystrix group "FortuneService" + // Add Hystrix command FortuneService to Hystrix group "FortuneService" services.AddHystrixCommand<FortuneServiceCommand>("FortuneService", Configuration); - // Add framework services. + // Add framework services. services.AddMvc(); ... } @@ -800,7 +803,7 @@ IFortuneService _fortuneService; ILogger<FortuneServiceCommand> _logger; - public FortuneServiceCommand(IHystrixCommandOptions options, + public FortuneServiceCommand(IHystrixCommandOptions options, IFortuneService fortuneService, ILogger<FortuneServiceCommand> logger) : base(options) { _fortuneService = fortuneService; @@ -824,23 +827,21 @@ { FortuneServiceCommand _fortuneServiceCommand; - public HomeController(FortuneServiceCommand fortuneServiceCommand) + public HomeController(FortuneServiceCommand fortuneServiceCommand) { _fortuneServiceCommand = fortuneServiceCommand; } [HttpGet("random")] - public async Task<Fortune> Random() + public async Task<Fortune> Random() { - return await _fortuneServiceCommand.RandomFortuneAsync(); + return await _fortuneServiceCommand.RandomFortuneAsync(); } [HttpGet] - public IActionResult Index() + public IActionResult Index() { - return View(); - } - + return View(); } }
@@ -854,28 +855,28 @@ IFortuneService _fortuneService; ILogger<FortuneServiceCommand> _logger; - public FortuneServiceCommand(IHystrixCommandOptions options, + public FortuneServiceCommand(IHystrixCommandOptions options, IFortuneService fortuneService, ILogger<FortuneServiceCommand> logger) : base(options) { _fortuneService = fortuneService; _logger = logger; IsFallbackUserDefined = true; } - public async Task<Fortune> RandomFortuneAsync() + public async Task<Fortune> RandomFortuneAsync() { - return await ExecuteAsync(); + return await ExecuteAsync(); } - protected override async Task<Fortune> RunAsync() + protected override async Task<Fortune> RunAsync() { - var result = await _fortuneService.RandomFortuneAsync(); + var result = await _fortuneService.RandomFortuneAsync(); _logger.LogInformation("Run: {0}", result); - return result; + return result; } - protected override async Task<Fortune> RunFallbackAsync() + protected override async Task<Fortune> RunFallbackAsync() { _logger.LogInformation("RunFallback"); - return await Task.FromResult<Fortune>(new Fortune() { Id = 9999, Text = "You will have a happy day!" }); + return await Task.FromResult<Fortune>(new Fortune() { Id = 9999, Text = "You will have a happy day!" }); } } @@ -938,20 +939,20 @@ IDisposable subscription = cold.Subscribe((result) => { Console.WriteLine(res public class Startup { ... - public IConfiguration Configuration { get; private set; } - public Startup(IConfiguration configuration) + public IConfiguration Configuration { get; private set; } + public Startup(IConfiguration configuration) { Configuration = configuration; } - public void ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { - // Add Steeltoe Discovery Client service + // Add Steeltoe Discovery Client service services.AddDiscoveryClient(Configuration); - // Add Hystrix collapser to the service container + // Add Hystrix collapser to the service container services.AddHystrixCollapser<FortuneServiceCollapser>("FortuneServiceCollapser", Configuration); - // Add framework services. + // Add framework services. services.AddMvc(); ... } @@ -969,7 +970,7 @@ IDisposable subscription = cold.Subscribe((result) => { Console.WriteLine(res ILoggerFactory _loggerFactory; IFortuneService _fortuneService; - public FortuneServiceCollapser(IHystrixCollapserOptions options, + public FortuneServiceCollapser(IHystrixCollapserOptions options, IFortuneService fortuneService, ILoggerFactory logFactory) : base(options) { _logger = logFactory.CreateLogger<FortuneServiceCollapser>(); @@ -993,30 +994,30 @@ IDisposable subscription = cold.Subscribe((result) => { Console.WriteLine(res { FortuneServiceCollapser _fortuneService; - public HomeController(FortuneServiceCollapser fortuneService) + public HomeController(FortuneServiceCollapser fortuneService) { _fortuneService = fortuneService; } [HttpGet("random")] - public async Task<Fortune> Random() + public async Task<Fortune> Random() { - // Fortune IDs are 1000-1049 - int id = random.Next(50) + 1000; - return GetFortuneById(id); + // Fortune IDs are 1000-1049 + int id = random.Next(50) + 1000; + return GetFortuneById(id); } [HttpGet] - public IActionResult Index() + public IActionResult Index() { - return View(); + return View(); } - protected Task<Fortune> GetFortuneById(int id) + protected Task<Fortune> GetFortuneById(int id) { - // Use the FortuneServiceCollapser to obtain a Fortune by its Fortune Id + // Use the FortuneServiceCollapser to obtain a Fortune by its Fortune Id _fortuneService.FortuneId = id; - return _fortuneService.ExecuteAsync(); + return _fortuneService.ExecuteAsync(); } } @@ -1032,7 +1033,7 @@ IDisposable subscription = cold.Subscribe((result) => { Console.WriteLine(res ILoggerFactory _loggerFactory; IFortuneService _fortuneService; - public FortuneServiceCollapser(IHystrixCollapserOptions options, + public FortuneServiceCollapser(IHystrixCollapserOptions options, IFortuneService fortuneService, ILoggerFactory logFactory) : base(options) { _logger = logFactory.CreateLogger<FortuneServiceCollapser>(); @@ -1040,27 +1041,27 @@ IDisposable subscription = cold.Subscribe((result) => { Console.WriteLine(res _fortuneService = fortuneService; } - public virtual int FortuneId { get; set; } + public virtual int FortuneId { get; set; } - public override int RequestArgument { get { return FortuneId; } } + public override int RequestArgument { get { return FortuneId; } } - protected override HystrixCommand<List<Fortune>> CreateCommand(ICollection<ICollapsedRequest<Fortune, int>> requests) + protected override HystrixCommand<List<Fortune>> CreateCommand(ICollection<ICollapsedRequest<Fortune, int>> requests) { _logger.LogInformation("Creating MultiFortuneServiceCommand to handle {0} number of requests", requests.Count); - return new MultiFortuneServiceCommand( + return new MultiFortuneServiceCommand( HystrixCommandGroupKeyDefault.AsKey("MultiFortuneService"), requests, _fortuneService, _loggerFactory.CreateLogger<MultiFortuneServiceCommand>()); } - protected override void MapResponseToRequests(List<Fortune> batchResponse, ICollection<ICollapsedRequest<Fortune, int>> requests) + protected override void MapResponseToRequests(List<Fortune> batchResponse, ICollection<ICollapsedRequest<Fortune, int>> requests) { - foreach(var f in batchResponse) + foreach(var f in batchResponse) { - foreach(var r in requests) + foreach(var r in requests) { - if (r.Argument == f.Id) + if (r.Argument == f.Id) { r.Response = f; } @@ -1138,23 +1139,23 @@ IDisposable subscription = cold.Subscribe((result) => { Console.WriteLine(res public class Startup { ... - public IConfiguration Configuration { get; private set; } - public Startup(IConfiguration configuration) + public IConfiguration Configuration { get; private set; } + public Startup(IConfiguration configuration) { - Configuration = configuration; + Configuration = configuration; } - public void ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { - // Add Steeltoe Discovery Client service + // Add Steeltoe Discovery Client service services.AddDiscoveryClient(Configuration); - // Add Hystrix command FortuneService to Hystrix group "FortuneServices" + // Add Hystrix command FortuneService to Hystrix group "FortuneServices" services.AddHystrixCommand<IFortuneService, FortuneService>("FortuneServices", Configuration); - // Add framework services. + // Add framework services. services.AddMvc(); - // Add Hystrix Metrics to container + // Add Hystrix Metrics to container services.AddHystrixMetricsStream(Configuration); ... } @@ -1171,25 +1172,25 @@ IDisposable subscription = cold.Subscribe((result) => { Console.WriteLine(res public class Startup { ... - public IConfiguration Configuration { get; private set; } - public Startup(IConfiguration configuration) + public IConfiguration Configuration { get; private set; } + public Startup(IConfiguration configuration) { - Configuration = configuration; + Configuration = configuration; } - public void ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { ... } - public void Configure(IApplicationBuilder app) + public void Configure(IApplicationBuilder app) { app.UseStaticFiles(); - // Use Hystrix Request contexts + // Use Hystrix Request contexts app.UseHystrixRequestContext(); app.UseMvc(); - // Start Hystrix metrics stream service + // Start Hystrix metrics stream service app.UseHystrixMetricsStream(); } ... @@ -1287,20 +1288,20 @@ cf push -f manifest-windows.yml -p bin/Debug/net461/
public class Program {
     ...
-					public static IWebHost BuildWebHost(string[] args)
+    public static IWebHost BuildWebHost(string[] args)
     {
-					return new WebHostBuilder()
+        return new WebHostBuilder()
             ...
             .UseCloudFoundryHosting()
             ...
             .ConfigureAppConfiguration((builderContext, configBuilder) =>
             {
-					var env = builderContext.HostingEnvironment;
+                var env = builderContext.HostingEnvironment;
                 configBuilder.SetBasePath(env.ContentRootPath)
                     .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                     .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                     .AddEnvironmentVariables()
-					// Add to configuration the Cloudfoundry VCAP settings
+                    // Add to configuration the Cloudfoundry VCAP settings
                     .AddCloudFoundry();
             })
             .Build();
diff --git a/src/Client/wwwroot/docs/steeltoe-discovery/index.html b/src/Client/wwwroot/docs/steeltoe-discovery/index.html
index 334042f..2868dd3 100644
--- a/src/Client/wwwroot/docs/steeltoe-discovery/index.html
+++ b/src/Client/wwwroot/docs/steeltoe-discovery/index.html
@@ -90,7 +90,7 @@
 
 
<ItemGroup>
 ...
-	<PackageReference Include="Steeltoe.Discovery.ClientCore" Version= "2.3.0"/>
+    <PackageReference Include="Steeltoe.Discovery.ClientCore" Version= "2.3.0"/>
 ...
 </ItemGroup>
 
@@ -105,36 +105,35 @@

You do these two things in the ConfigureServices() and Configure() methods of the Startup class, as shown in the following example:

-
using Pivotal.Discovery.Client;
-// or
+

 using Steeltoe.Discovery.Client;
 
 public class Startup {
-...
-	public IConfiguration Configuration { get; private set; }
-	public Startup(...)
-{
-  ...
-}
-		public void ConfigureServices(IServiceCollection services)
-{
-		// Add Steeltoe Discovery Client service
-  services.AddDiscoveryClient(Configuration);
+    ...
+    public IConfiguration Configuration { get; private set; }
+    public Startup(...)
+    {
+        ...
+    }
+    public void ConfigureServices(IServiceCollection services)
+    {
+        // Add Steeltoe Discovery Client service
+        services.AddDiscoveryClient(Configuration);
 
-		// Add framework services.
-  services.AddMvc();
-  ...
-}
-		public void Configure(IApplicationBuilder app, ...)
-{
-  ...
-  app.UseStaticFiles();
-  app.UseMvc();
+        // Add framework services.
+        services.AddMvc();
+        ...
+    }
+    public void Configure(IApplicationBuilder app, ...)
+    {
+        ...
+        app.UseStaticFiles();
+        app.UseMvc();
 
-		// Use the Steeltoe Discovery Client service
-  app.UseDiscoveryClient();
-}
-...
+        // Use the Steeltoe Discovery Client service
+        app.UseDiscoveryClient();
+    }
+    ...
 
@@ -165,30 +164,29 @@

This FortuneService class retrieves fortunes from the Fortune microservice, which is registered under a name of fortuneService:

-
using Pivotal.Discovery.Client;
-// or
-// using Steeltoe.Discovery.Client;
+

+using Steeltoe.Discovery.Client;
 
 ...
 public class FortuneService : IFortuneService
 {
     DiscoveryHttpClientHandler _handler;
-					private const string RANDOM_FORTUNE_URL = "https://fortuneService/api/fortunes/random";
-					public FortuneService(IDiscoveryClient client)
+    private const string RANDOM_FORTUNE_URL = "https://fortuneService/api/fortunes/random";
+    public FortuneService(IDiscoveryClient client)
     {
         _handler = new DiscoveryHttpClientHandler(client);
     }
-					public async Task<string> RandomFortuneAsync()
+    public async Task<string> RandomFortuneAsync()
     {
-					var client = GetClient();
-					return await client.GetStringAsync(RANDOM_FORTUNE_URL);
+        var client = GetClient();
+        return await client.GetStringAsync(RANDOM_FORTUNE_URL);
     }
-					private HttpClient GetClient()
+    private HttpClient GetClient()
     {
-					// WARNING: do NOT create a new HttpClient for every request in your code
-					// -- you may experience socket exhaustion if you do!
-					var client = new HttpClient(_handler, false);
-					return client;
+        // WARNING: do NOT create a new HttpClient for every request in your code
+        // -- you may experience socket exhaustion if you do!
+        var client = new HttpClient(_handler, false);
+        return client;
     }
 }
 
@@ -214,20 +212,20 @@
public class Startup
 {
     ...
-					public void ConfigureServices(IServiceCollection services)
+    public void ConfigureServices(IServiceCollection services)
     {
-      ...
-					// Add Steeltoe handler to container (this line can be omitted when using Steeltoe versions >= 2.2.0)
-      services.AddTransient<DiscoveryHttpMessageHandler>();
+        ...
+        // Add Steeltoe handler to container (this line can be omitted when using Steeltoe versions >= 2.2.0)
+        services.AddTransient<DiscoveryHttpMessageHandler>();
 
-					// Configure HttpClient
-      services.AddHttpClient("fortunes", c =>
-      {
-        c.BaseAddress = new Uri("https://fortuneService/api/fortunes/");
-      })
-      .AddHttpMessageHandler<DiscoveryHttpMessageHandler>()
-      .AddTypedClient<IFortuneService, FortuneService>();
-      ...
+        // Configure HttpClient
+        services.AddHttpClient("fortunes", c =>
+        {
+            c.BaseAddress = new Uri("https://fortuneService/api/fortunes/");
+        })
+        .AddHttpMessageHandler<DiscoveryHttpMessageHandler>()
+        .AddTypedClient<IFortuneService, FortuneService>();
+        ...
     }
     ...
 }
@@ -237,15 +235,15 @@
 
 
public class FortuneService : IFortuneService
 {
-					private const string RANDOM_FORTUNE_URL = "https://fortuneService/api/fortunes/random";
-					private HttpClient _client;
-					public FortuneService(HttpClient client)
+    private const string RANDOM_FORTUNE_URL = "https://fortuneService/api/fortunes/random";
+    private HttpClient _client;
+    public FortuneService(HttpClient client)
     {
         _client = client;
     }
-					public async Task<string> RandomFortuneAsync()
+    public async Task<string> RandomFortuneAsync()
     {
-					return await _client.GetStringAsync(RANDOM_FORTUNE_URL);
+        return await _client.GetStringAsync(RANDOM_FORTUNE_URL);
     }
 }
 
@@ -285,22 +283,22 @@ IList<string> Services { public interface ILoadBalancer { - /// <summary> - /// Evaluates a Uri for a host name that can be resolved into a service instance - /// </summary> - /// <param name="request">A Uri containing a service name that can be resolved into one or more service instances</param> - /// <returns>The original Uri, with serviceName replaced by the host:port of a service instance</returns> - Task<Uri> ResolveServiceInstanceAsync(Uri request); + /// <summary> + /// Evaluates a Uri for a host name that can be resolved into a service instance + /// </summary> + /// <param name="request">A Uri containing a service name that can be resolved into one or more service instances</param> + /// <returns>The original Uri, with serviceName replaced by the host:port of a service instance</returns> + Task<Uri> ResolveServiceInstanceAsync(Uri request); - /// <summary> - /// A mechanism for tracking statistics for service instances - /// </summary> - /// <param name="originalUri">The original request Uri</param> - /// <param name="resolvedUri">The Uri resolved by the load balancer</param> - /// <param name="responseTime">The amount of time taken for a remote call to complete</param> - /// <param name="exception">Any exception called during calls to a resolved service instance</param> - /// <returns>A task</returns> - Task UpdateStatsAsync(Uri originalUri, Uri resolvedUri, TimeSpan responseTime, Exception exception); + /// <summary> + /// A mechanism for tracking statistics for service instances + /// </summary> + /// <param name="originalUri">The original request Uri</param> + /// <param name="resolvedUri">The Uri resolved by the load balancer</param> + /// <param name="responseTime">The amount of time taken for a remote call to complete</param> + /// <param name="exception">Any exception called during calls to a resolved service instance</param> + /// <returns>A task</returns> + Task UpdateStatsAsync(Uri originalUri, Uri resolvedUri, TimeSpan responseTime, Exception exception); }
@@ -331,12 +329,12 @@ IList<string> Services { private HttpClient _httpClient; - public FortuneService(IDiscoveryClient discoveryClient) - { - var loadBalancer = new RandomLoadBalancer(discoveryClient); - var handler = new LoadBalancerHttpClientHandler(loadBalancer); - _httpClient = new HttpClient(handler); - } + public FortuneService(IDiscoveryClient discoveryClient) + { + var loadBalancer = new RandomLoadBalancer(discoveryClient); + var handler = new LoadBalancerHttpClientHandler(loadBalancer); + _httpClient = new HttpClient(handler); + }

1.4.3 Round Robin Load Balancer

@@ -360,13 +358,14 @@ IList<string> Services { private HttpClient _httpClient; - public FortuneService(IDiscoveryClient discoveryClient) - { - var loadBalancer = new RoundRobinLoadBalancer(discoveryClient); - var handler = new LoadBalancerHttpClientHandler(loadBalancer); - _httpClient = new HttpClient(handler); - } +

+    private HttpClient _httpClient;
+    public FortuneService(IDiscoveryClient discoveryClient)
+    {
+        var loadBalancer = new RoundRobinLoadBalancer(discoveryClient);
+        var handler = new LoadBalancerHttpClientHandler(loadBalancer);
+        _httpClient = new HttpClient(handler);
+    }
 

1.4.4 Custom ILoadBalancer

@@ -375,23 +374,24 @@ IList<string> Services { private readonly IServiceInstanceProvider _serviceInstanceProvider; +

+    private readonly IServiceInstanceProvider _serviceInstanceProvider;
 
-					public FirstInstanceLoadBalancer(IServiceInstanceProvider serviceInstanceProvider)
-  {
-      _serviceInstanceProvider = serviceInstanceProvider;
-  }
+    public FirstInstanceLoadBalancer(IServiceInstanceProvider serviceInstanceProvider)
+    {
+        _serviceInstanceProvider = serviceInstanceProvider;
+    }
 
-					public Task<Uri> ResolveServiceInstanceAsync(Uri request)
-  {
-					var availableServiceInstances = _serviceInstanceProvider.GetInstances(request.Host);
-					return Task.FromResult(new Uri(availableServiceInstances[0].Uri, request.PathAndQuery));
-  }
+    public Task<Uri> ResolveServiceInstanceAsync(Uri request)
+    {
+        var availableServiceInstances = _serviceInstanceProvider.GetInstances(request.Host);
+        return Task.FromResult(new Uri(availableServiceInstances[0].Uri, request.PathAndQuery));
+    }
 
-					public Task UpdateStatsAsync(Uri originalUri, Uri resolvedUri, TimeSpan responseTime, Exception exception)
-  {
-					return Task.CompletedTask;
-  }
+    public Task UpdateStatsAsync(Uri originalUri, Uri resolvedUri, TimeSpan responseTime, Exception exception)
+    {
+        return Task.CompletedTask;
+    }
 

1.4.4.1 Usage with HttpClientFactory

@@ -408,13 +408,14 @@ IList<string> Services { private HttpClient _httpClient; - public FortuneService(IDiscoveryClient discoveryClient) - { - var loadBalancer = new FirstInstanceLoadBalancer(discoveryClient); - var handler = new LoadBalancerHttpClientHandler(loadBalancer); - _httpClient = new HttpClient(handler); - } +

+    private HttpClient _httpClient;
+    public FortuneService(IDiscoveryClient discoveryClient)
+    {
+        var loadBalancer = new FirstInstanceLoadBalancer(discoveryClient);
+        var handler = new LoadBalancerHttpClientHandler(loadBalancer);
+        _httpClient = new HttpClient(handler);
+    }
 

1.5 Enable Logging

@@ -424,14 +425,14 @@ IList<string> Services { { - "Logging": { - "IncludeScopes": false, - "LogLevel": { - "Default": "Warning", - "Pivotal": "Debug", - "Steeltoe": "Debug" - } - }, + "Logging": { + "IncludeScopes": false, + "LogLevel": { + "Default": "Warning", + "Pivotal": "Debug", + "Steeltoe": "Debug" + } + }, ... }
@@ -761,14 +762,15 @@ IList<string> Services { { "spring": { - "application": { - "name": "fortuneUI" + "application": + { + "name": "fortuneUI" } }, - "eureka": { - "client": { - "serviceUrl": "http://localhost:8761/eureka/", - "shouldRegisterWithEureka": false +"eureka": { + "client": { + "serviceUrl": "http://localhost:8761/eureka/", + "shouldRegisterWithEureka": false } } ... @@ -786,20 +788,20 @@ IList<string> Services { { - "spring": { - "application": { - "name": "fortuneService" - } - }, - "eureka": { - "client": { - "serviceUrl": "http://localhost:8761/eureka/", - "shouldFetchRegistry": false + "spring": { + "application": { + "name": "fortuneService" + } }, - "instance": { - "port": 5000 + "eureka": { + "client": { + "serviceUrl": "http://localhost:8761/eureka/", + "shouldFetchRegistry": false + }, + "instance": { + "port": 5000 + } } - } ... }
@@ -834,14 +836,14 @@ cf restage myApp

Sometimes, it is desirable to turn on debug logging in the Eureka client. To do that simply add the following to your appsettings.json:

{
-					"Logging": {
-					"IncludeScopes": false,
-					"LogLevel": {
-					"Default": "Information",
-					"Pivotal": "Debug",
-					"Steeltoe":  "Debug"
+    "Logging": {
+        "IncludeScopes": false,
+        "LogLevel": {
+            "Default": "Information",
+            "Pivotal": "Debug",
+            "Steeltoe":  "Debug"
+        }
     }
-  }
 }
 
@@ -1166,14 +1168,14 @@ cf restage myApp

Sometimes, it is desirable to turn on debug logging. To do that simply add the following to your appsettings.json:

{
-					"Logging": {
-					"IncludeScopes": false,
-					"LogLevel": {
-					"Default": "Information",
-					"Pivotal": "Debug",
-					"Steeltoe":  "Debug"
+    "Logging": {
+        "IncludeScopes": false,
+        "LogLevel": {
+            "Default": "Information",
+            "Pivotal": "Debug",
+            "Steeltoe":  "Debug"
+        }
     }
-  }
 }
 
@@ -1196,22 +1198,22 @@ cf restage myApp

Tags with the form key=value will be split and used as IDictionary keys and values respectively. Tags without the equal sign will be used as both the key and value. You can add metadata with the consul:discovery:tags string array:

{
-					"consul": {
-					"discovery": {
-					"tags": [
-					"somekey=somevalue",
-					"someothervalue"
-      ]
+    "consul": {
+        "discovery": {
+            "tags": [
+                "somekey=somevalue",
+                "someothervalue"
+            ]
+        }
     }
-  }
 }
 

The above tag list results in metadata that looks like this:

{
-					"somekey": "somevalue",
-					"someothervalue": "someothervalue"
+    "somekey": "somevalue",
+    "someothervalue": "someothervalue"
 }
 
@@ -1283,20 +1285,20 @@ cf push -f manifest-windows.yml -p bin/Debug/net461/
public class Program {
     ...
-					public static IWebHost BuildWebHost(string[] args)
+    public static IWebHost BuildWebHost(string[] args)
     {
-					return new WebHostBuilder()
+        return new WebHostBuilder()
             ...
             .UseCloudFoundryHosting()
             ...
             .ConfigureAppConfiguration((builderContext, configBuilder) =>
             {
-					var env = builderContext.HostingEnvironment;
+                var env = builderContext.HostingEnvironment;
                 configBuilder.SetBasePath(env.ContentRootPath)
                     .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                     .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                     .AddEnvironmentVariables()
-					// Add to configuration the Cloudfoundry VCAP settings
+                    // Add to configuration the Cloudfoundry VCAP settings
                     .AddCloudFoundry();
             })
             .Build();
diff --git a/src/Client/wwwroot/docs/steeltoe-logging/index.html b/src/Client/wwwroot/docs/steeltoe-logging/index.html
index 483deb1..2011495 100644
--- a/src/Client/wwwroot/docs/steeltoe-logging/index.html
+++ b/src/Client/wwwroot/docs/steeltoe-logging/index.html
@@ -65,7 +65,7 @@
 
 
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.Extensions.Logging.DynamicLogger" Version= "2.3.0"/>
+    <PackageReference Include="Steeltoe.Extensions.Logging.DynamicLogger" Version= "2.3.0"/>
 ...
 </ItemGroup>
 
@@ -81,9 +81,9 @@
using Steeltoe.Extensions.Logging;
 public class Program
 {
-					public static void Main(string[] args)
+    public static void Main(string[] args)
     {
-					var host = new WebHostBuilder()
+        var host = new WebHostBuilder()
             .UseKestrel()
             .UseCloudFoundryHosting()
             .UseContentRoot(Directory.GetCurrentDirectory())
@@ -102,7 +102,7 @@
             {
                 loggingBuilder.AddConfiguration(builderContext.Configuration.GetSection("Logging"));
 
-					// Add Steeltoe Dynamic Logging provider
+                // Add Steeltoe Dynamic Logging provider
                 loggingBuilder.AddDynamicConsole();
             })
             .Build();
@@ -140,7 +140,7 @@
 
 
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.Extensions.Logging.SerilogDynamicLogger" Version= "2.3.0"/>
+    <PackageReference Include="Steeltoe.Extensions.Logging.SerilogDynamicLogger" Version= "2.3.0"/>
 ...
 </ItemGroup>
 
@@ -151,29 +151,29 @@
...
 
-					"Serilog": {
-					"IncludeScopes": false,
-					"MinimumLevel": {
-					"LogLevel": {
-					"Default": "Warning",
-					"Override": {
-					"Pivotal": "Information",
-					"Microsoft": "Warning",
-					"Steeltoe": "Information",
-					"CloudFoundry.Controllers": "Verbose"
+    "Serilog": {
+        "IncludeScopes": false,
+        "MinimumLevel": {
+            "LogLevel": {
+                "Default": "Warning",
+                "Override": {
+                    "Pivotal": "Information",
+                    "Microsoft": "Warning",
+                    "Steeltoe": "Information",
+                    "CloudFoundry.Controllers": "Verbose"
                 }
+            },
+            "WriteTo": [
+                {
+                    "Name": "Console",
+                    "Args": {
+                        "outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext}: {Properties} {NewLine} {EventId} {Message:lj}{NewLine}{Exception}"
+                    }
+                }
+            ],
+            "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
         },
-					"WriteTo": [
-            {
-					"Name": "Console",
-					"Args": {
-					"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext}: {Properties} {NewLine} {EventId} {Message:lj}{NewLine}{Exception}"
-                }
-            }
-        ],
-					"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
     },
-},
 ...
 
@@ -184,9 +184,9 @@
using Steeltoe.Extensions.Logging;
 public class Program
 {
-					public static void Main(string[] args)
+    public static void Main(string[] args)
     {
-					var host = new WebHostBuilder()
+        var host = new WebHostBuilder()
             .UseKestrel()
             .UseCloudFoundryHosting()
             .UseContentRoot(Directory.GetCurrentDirectory())
@@ -205,7 +205,7 @@
             {
                 loggingBuilder.AddConfiguration(builderContext.Configuration.GetSection("Logging"));
 
-					// Add Serilog Dynamic Logger 
+                // Add Serilog Dynamic Logger 
                 loggingBuilder.AddSerilogDynamicConsole();
             })
             .Build();
diff --git a/src/Client/wwwroot/docs/steeltoe-management/index.html b/src/Client/wwwroot/docs/steeltoe-management/index.html
index b649a64..73d5bd5 100644
--- a/src/Client/wwwroot/docs/steeltoe-management/index.html
+++ b/src/Client/wwwroot/docs/steeltoe-management/index.html
@@ -247,12 +247,12 @@
 
 
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.Management.EndpointCore" Version= "2.2.0"/>
+    <PackageReference Include="Steeltoe.Management.EndpointCore" Version= "2.2.0"/>
 ...
 </ItemGroup>
 
-

or

+

or

PM>Install-Package  Steeltoe.Management.EndpointWeb -Version 2.2.0
 
@@ -320,14 +320,14 @@

"management": {
-					"endpoints": {
-					"actuator":{
-					"exposure": {
-					"include": [ "*" ],
-					"exclude": [ "env", "refresh"]
-            }
-        }
+  "endpoints": {
+    "actuator":{
+      "exposure": {
+        "include": [ "*" ],
+        "exclude": [ "env", "refresh"]
+      }
     }
+  }
 }
 
@@ -524,15 +524,15 @@

The default value is always. Authorized roles can be configured using management:endpoints:health:claim or management:endpoints:health:role. A user is considered to be authorized when they are in the given role or have the specified claim. For example:

"management": {
-					"endpoints": {
-					"health": {
-					"showdetails": "whenauthorized",
-					"claim": {
-					"type": "health_actuator",
-					"value": "see_details"
-            }
-        }
+  "endpoints": {
+    "health": {
+      "showdetails": "whenauthorized",
+      "claim": {
+        "type": "health_actuator",
+        "value": "see_details"
+      }
     }
+  }
 }
 
@@ -579,17 +579,17 @@
public class CustomHealthContributor : IHealthContributor
 {
-					public string Id => "CustomHealthContributor";
+    public string Id => "CustomHealthContributor";
 
-					public HealthCheckResult Health()
+    public HealthCheckResult Health()
     {
-					var result = new HealthCheckResult {
-					// this is used as part of the aggregate, it is not directly part of the middleware response
+        var result = new HealthCheckResult {
+            // this is used as part of the aggregate, it is not directly part of the middleware response
             Status = HealthStatus.UP,
             Description = "This health check does not check anything"
         };
         result.Details.Add("status", HealthStatus.UP.ToString());
-					return result;
+        return result;
     }
 }
 
@@ -651,22 +651,25 @@
public class Startup
 {
     ...
-					public void ConfigureServices(IServiceCollection services)
-    {
-					// Add your own IHealthContributor, registered with the interface
+    public void ConfigureServices(IServiceCollection services)
+    
+    {
+        // Add your own IHealthContributor, registered with the interface
         services.AddSingleton<IHealthContributor, CustomHealthContributor>();
 
-					// Add health actuator
+        // Add health actuator
         services.AddHealthActuator(Configuration);
 
-					// Add framework services.
+        // Add framework services.
         services.AddMvc();
     }
-					public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
-    {
+    
+    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
+    
+    {
         app.UseStaticFiles();
 
-					// Add management endpoint into pipeline
+        // Add management endpoint into pipeline
         app.UseHealthActuator();
     }
 }
@@ -686,24 +689,26 @@
 
 
public class ManagementConfig
 {
-					public static void ConfigureManagementActuators(IConfiguration configuration, ILoggerFactory loggerFactory = null)
+    public static void ConfigureManagementActuators(IConfiguration configuration, ILoggerFactory loggerFactory = null)
     {
         ...
         ActuatorConfigurator.UseHealthActuator(
             configuration,
-					new DefaultHealthAggregator(),
+            new DefaultHealthAggregator(),
             GetHealthContributors(configuration),
             loggerFactory);
         ...
     }
-					private static IEnumerable<IHealthContributor> GetHealthContributors(IConfiguration configuration)
-    {
-					var healthContributors = new List<IHealthContributor>
+
+    private static IEnumerable<IHealthContributor> GetHealthContributors(IConfiguration configuration)
+    
+    {
+        var healthContributors = new List<IHealthContributor>
         {
-					new DiskSpaceContributor(),
+            new DiskSpaceContributor(),
             RelationalHealthContributor.GetMySqlContributor(configuration)
         };
-					return healthContributors;
+        return healthContributors;
     }
 
@@ -722,20 +727,22 @@ { ... app.UseHealthActuator( - new HealthOptions(ApplicationConfig.Configuration), - new DefaultHealthAggregator(), + new HealthOptions(ApplicationConfig.Configuration), + new DefaultHealthAggregator(), GetHealthContributors(ApplicationConfig.Configuration), LoggingConfig.LoggerFactory); ... } - private static IEnumerable<IHealthContributor> GetHealthContributors(IConfiguration configuration) - { - var healthContributors = new List<IHealthContributor> - { - new DiskSpaceContributor(), - RelationalHealthContributor.GetMySqlContributor(configuration) - }; - return healthContributors; + + private static IEnumerable<IHealthContributor> GetHealthContributors(IConfiguration configuration) + + { + var healthContributors = new List<IHealthContributor> + { + new DiskSpaceContributor(), + RelationalHealthContributor.GetMySqlContributor(configuration) + }; + return healthContributors; } }
@@ -777,9 +784,10 @@
public class ArbitraryInfoContributor : IInfoContributor
 {
-					public void Contribute(IInfoBuilder builder)
-    {
-					// pass in the info
+    public void Contribute(IInfoBuilder builder)
+    
+    {
+        // pass in the info
         builder.WithInfo("arbitraryInfo", new { someProperty = "someValue" });
     }
 }
@@ -850,22 +858,24 @@
 
public class Startup
 {
     ...
-					public void ConfigureServices(IServiceCollection services)
-    {
-					// Add custom info contributor, specifying the interface type
+    public void ConfigureServices(IServiceCollection services)
+    
+    {
+        // Add custom info contributor, specifying the interface type
         services.AddSingleton<IInfoContributor, ArbitraryInfoContributor>();
 
-					// Add Info actuator
+        // Add Info actuator
         services.AddInfoActuator(Configuration);
 
-					// Add framework services.
+        // Add framework services.
         services.AddMvc();
     }
-					public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
+
+    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
     {
         app.UseStaticFiles();
 
-					// Add management endpoint into pipeline
+        // Add management endpoint into pipeline
         app.UseInfoActuator();
     }
 }
@@ -881,16 +891,19 @@
 
 
public class ManagementConfig
 {
-					public static void ConfigureManagementActuators(IConfiguration configuration, ILoggerFactory loggerFactory)
-    {
+    public static void ConfigureManagementActuators(IConfiguration configuration, ILoggerFactory loggerFactory)
+    
+    {
         ...
         ActuatorConfigurator.UseInfoActuator(configuration, GetInfoContributors(configuration), loggerFactory);
         ...
     }
-					private static IEnumerable<IInfoContributor> GetInfoContributors(IConfiguration configuration)
-    {
-					var contributors = new List<IInfoContributor>() { new GitInfoContributor(), new AppSettingsInfoContributor(configuration) }
-					return contributors;
+
+    private static IEnumerable<IInfoContributor> GetInfoContributors(IConfiguration configuration)
+    
+    {
+        var contributors = new List<IInfoContributor>() { new GitInfoContributor(), new AppSettingsInfoContributor(configuration) }
+        return contributors;
     }
 
@@ -905,8 +918,9 @@
public class Startup
 {
     ...
-					public void Configuration(IAppBuilder app)
-    {
+    public void Configuration(IAppBuilder app)
+    
+    {
         ...
         app.UseInfoActuator(
             ApplicationConfig.Configuration,
@@ -914,10 +928,12 @@
             LoggingConfig.LoggerFactory);
         ...
     }
-					private static IEnumerable<IInfoContributor> GetInfoContributors(IConfiguration configuration)
-    {
-					var contributors = new List<IInfoContributor>() { new GitInfoContributor(), new AppSettingsInfoContributor(configuration) }
-					return contributors;
+
+    private static IEnumerable<IInfoContributor> GetInfoContributors(IConfiguration configuration)
+    
+    {
+        var contributors = new List<IInfoContributor>() { new GitInfoContributor(), new AppSettingsInfoContributor(configuration) }
+        return contributors;
     }
 }
 
@@ -989,9 +1005,10 @@
using Steeltoe.Extensions.Logging;
 public class Program
 {
-					public static void Main(string[] args)
-    {
-					var host = new WebHostBuilder()
+    public static void Main(string[] args)
+    
+    {
+        var host = new WebHostBuilder()
             .UseKestrel()
             .UseContentRoot(Directory.GetCurrentDirectory())
             .UseStartup<Startup>()
@@ -1006,7 +1023,7 @@
             {
                 loggingBuilder.AddConfiguration(builderContext.Configuration.GetSection("Logging"));
 
-					// Add Steeltoe dynamic console logger
+                // Add Steeltoe dynamic console logger
                 loggingBuilder.AddDynamicConsole();
             })
             .Build();
@@ -1026,7 +1043,7 @@
 
 
public class ManagementConfig
 {
-					public static void ConfigureManagementActuators(IConfiguration configuration)
+    public static void ConfigureManagementActuators(IConfiguration configuration)
     {
         ...
         ActuatorConfigurator.UseLoggerActuator(configuration, LoggingConfig.LoggerProvider, LoggingConfig.LoggerProvider);
@@ -1038,10 +1055,10 @@
 
 
public static class LoggingConfig
 {
-					public static ILoggerFactory LoggerFactory { get; set; }
-					public static ILoggerProvider LoggerProvider { get; set; }
+    public static ILoggerFactory LoggerFactory { get; set; }
+    public static ILoggerProvider LoggerProvider { get; set; }
 
-					public static void Configure(IConfiguration configuration)
+    public static void Configure(IConfiguration configuration)
     {
         LoggerProvider = new DynamicLoggerProvider(new ConsoleLoggerSettings().FromConfiguration(configuration));
         LoggerFactory = new LoggerFactory();
@@ -1061,7 +1078,7 @@
 
public class Startup
 {
     ...
-					public void Configuration(IAppBuilder app)
+    public void Configuration(IAppBuilder app)
     {
         ...
         app.UseLoggersActuator(
@@ -1077,10 +1094,10 @@
 
 
public static class LoggingConfig
 {
-					public static ILoggerFactory LoggerFactory { get; set; }
-					public static ILoggerProvider LoggerProvider { get; set; }
+    public static ILoggerFactory LoggerFactory { get; set; }
+    public static ILoggerProvider LoggerProvider { get; set; }
 
-					public static void Configure(IConfiguration configuration)
+    public static void Configure(IConfiguration configuration)
     {
         LoggerProvider = new DynamicLoggerProvider(new ConsoleLoggerSettings().FromConfiguration(configuration));
         LoggerFactory = new LoggerFactory();
@@ -1096,7 +1113,7 @@
 					

Log levels can be changed at namespace or class levels with an HTTP POST request to /{LoggersActuatorPath}/{NamespaceOrClassName} and a JSON request body that defines the minimum level you wish to log:

{
-					"configuredLevel":"INFO"
+    "configuredLevel":"INFO"
 }
 
@@ -1684,7 +1701,7 @@
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.Management.ExporterCore" Version= "2.1.0"/>
+    <PackageReference Include="Steeltoe.Management.ExporterCore" Version= "2.1.0"/>
 ...
 </ItemGroup>
 
@@ -1934,7 +1951,7 @@
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.Management.TracingCore" Version= "2.1.0"/>
+    <PackageReference Include="Steeltoe.Management.TracingCore" Version= "2.1.0"/>
 ...
 </ItemGroup>
 
@@ -2036,23 +2053,23 @@
public class Startup
 {
-					public Startup(IConfiguration configuration)
+    public Startup(IConfiguration configuration)
     {
         Configuration = configuration;
     }
 
-					public IConfiguration Configuration { get; set; }
+    public IConfiguration Configuration { get; set; }
 
-					public void ConfigureServices(IServiceCollection services)
+    public void ConfigureServices(IServiceCollection services)
     {
         ...
-					// Add Distributed tracing
+        // Add Distributed tracing
         services.AddDistributedTracing(Configuration);
 
-					// Add framework services.
+        // Add framework services.
         services.AddMvc();
     }
-					public void Configure(IApplicationBuilder app)
+    public void Configure(IApplicationBuilder app)
     {
         app.UseStaticFiles();
 
@@ -2081,7 +2098,7 @@
 
 
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.Management.ExporterCore" Version= "2.1.0"/>
+    <PackageReference Include="Steeltoe.Management.ExporterCore" Version= "2.1.0"/>
 ...
 </ItemGroup>
 
@@ -2149,25 +2166,27 @@
public class Startup
 {
-					public Startup(IConfiguration configuration)
+    public Startup(IConfiguration configuration)
     {
         Configuration = configuration;
     }
-					public void ConfigureServices(IServiceCollection services)
+
+    public void ConfigureServices(IServiceCollection services)
     {
-					// Add Distributed tracing
+        // Add Distributed tracing
         services.AddDistributedTracing(Configuration);
 
-					// Export traces to Zipkin
+        // Export traces to Zipkin
         services.AddZipkinExporter(Configuration);
         ...
     }
-					public void Configure(IApplicationBuilder app)
+
+    public void Configure(IApplicationBuilder app)
     {
         app.UseStaticFiles();
         app.UseMvc();
 
-					// Start up trace exporter
+        // Start up trace exporter
         app.UseTracingExporter();
     }
 }
@@ -2187,7 +2206,7 @@
 
 
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.Management.TaskCore" Version= "2.3.0"/>
+    <PackageReference Include="Steeltoe.Management.TaskCore" Version= "2.3.0"/>
 ...
 </ItemGroup>
 
@@ -2213,15 +2232,15 @@ /// </summary> public interface IApplicationTask { - /// <summary> - /// Gets globally unique name for the task - /// </summary> - string Name { get; } + /// <summary> + /// Gets globally unique name for the task + /// </summary> + string Name { get; } - /// <summary> - /// Action which to run - /// </summary> - void Run(); + /// <summary> + /// Action which to run + /// </summary> + void Run(); }
@@ -2288,10 +2307,10 @@
# Push to Linux cell
 cf push -f manifest.yml -p bin/Debug/netcoreapp2.1/ubuntu.14.04-x64/publish
 
-					# Push to Windows cell, .NET Core
+    # Push to Windows cell, .NET Core
 cf push -f manifest-windows.yml -p bin/Debug/netcoreapp2.1/win10-x64/publish
 
-					# Push to Windows cell, .NET Framework
+    # Push to Windows cell, .NET Framework
 cf push -f manifest-windows.yml -p bin/Debug/net461/win10-x64/publish
 
@@ -2315,25 +2334,27 @@ cf push -f manifest-windows.yml -p bin/Debug/net461/
public class Startup
 {
-					public IConfiguration Configuration { get; }
-					public Startup(IConfiguration configuration)
+    public IConfiguration Configuration { get; }
+    public Startup(IConfiguration configuration)
     {
         Configuration = configuration;
     }
-					public void ConfigureServices(IServiceCollection services)
+
+    public void ConfigureServices(IServiceCollection services)
     {
         ...
-					// Add all management endpoint services
+        // Add all management endpoint services
         services.AddCloudFoundryActuators(Configuration);
         ...
     }
-					public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
+
+    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
     {
         ...
-					// Add all management endpoints into pipeline
+        // Add all management endpoints into pipeline
         app.UseCloudFoundryActuators();
 
-					// Add ASP.NET Core MVC middleware to pipeline
+        // Add ASP.NET Core MVC middleware to pipeline
         app.UseMvc();
         ...
     }
@@ -2377,9 +2398,9 @@ cf push -f manifest-windows.yml -p bin/Debug/net461/
 
 
public class ManagementConfig
 {
-					public static IMetricsExporter MetricsExporter { get; set; }
+    public static IMetricsExporter MetricsExporter { get; set; }
 
-					public static void ConfigureActuators(
+    public static void ConfigureActuators(
         IConfiguration config,
         ILoggerProvider logger,
          IEnumerable<IHealthContributor> contrib,
@@ -2389,19 +2410,19 @@ cf push -f manifest-windows.yml -p bin/Debug/net461/
         ActuatorConfigurator.UseCloudFoundryActuators(config, logger, contrib, api, factory);
     }
 
-					public static void Start()
+    public static void Start()
     {
         DiagnosticsManager.Instance.Start();
-					if (MetricsExporter != null)
+        if (MetricsExporter != null)
         {
             MetricsExporter.Start();
         }
     }
 
-					public static void Stop()
+    public static void Stop()
     {
         DiagnosticsManager.Instance.Stop();
-					if (MetricsExporter != null)
+        if (MetricsExporter != null)
         {
             MetricsExporter.Stop();
         }
@@ -2447,11 +2468,11 @@ cf push -f manifest-windows.yml -p bin/Debug/net461/
 
 
public class Startup
 {
-					private IMetricsExporter MetricsExporter { get; set; }
+    private IMetricsExporter MetricsExporter { get; set; }
 
-					public void Configuration(IAppBuilder app)
+    public void Configuration(IAppBuilder app)
     {
-					var config = GlobalConfiguration.Configuration;
+        var config = GlobalConfiguration.Configuration;
 
         app.UseCloudFoundryActuators(
             ApplicationConfig.Configuration,
@@ -2463,19 +2484,19 @@ cf push -f manifest-windows.yml -p bin/Debug/net461/
         Start();
     }
 
-					private void Start()
+    private void Start()
     {
         DiagnosticsManager.Instance.Start();
-					if (MetricsExporter != null)
+        if (MetricsExporter != null)
         {
             MetricsExporter.Start();
         }
     }
 
-					public void Stop()
+    public void Stop()
     {
         DiagnosticsManager.Instance.Stop();
-					if (MetricsExporter != null)
+        if (MetricsExporter != null)
         {
             MetricsExporter.Stop();
         }
diff --git a/src/Client/wwwroot/docs/steeltoe-security/index.html b/src/Client/wwwroot/docs/steeltoe-security/index.html
index a1ba5b1..ed38cd6 100644
--- a/src/Client/wwwroot/docs/steeltoe-security/index.html
+++ b/src/Client/wwwroot/docs/steeltoe-security/index.html
@@ -73,7 +73,7 @@
 
 
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.Security.Authentication.CloudFoundryCore" Version= "2.3.0"/>
+    <PackageReference Include="Steeltoe.Security.Authentication.CloudFoundryCore" Version= "2.3.0"/>
 ...
 </ItemGroup>
 
@@ -83,13 +83,13 @@

Configuring settings for the provider beyond what is provided in a service binding is not typically required, but when Cloud Foundry is using self-signed certificates, you might need to disable certificate validation, as shown in the following example:

{
-					"security": {
-					"oauth2": {
-					"client": {
-					"validateCertificates": false
-      }
+    "security": {
+        "oauth2": {
+            "client": {
+                "validateCertificates": false
+            }
+        }
     }
-  }
 }
 
@@ -140,12 +140,12 @@ public class Startup { ... - public IConfiguration Configuration { get; private set; } - public Startup(IConfiguration configuration) + public IConfiguration Configuration { get; private set; } + public Startup(IConfiguration configuration) { Configuration = configuration; } - public void ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { ... services.AddAuthentication(options => @@ -155,23 +155,23 @@ }) .AddCookie((options) => { - // set values like login url, access denied path, etc here + // set values like login url, access denied path, etc here options.AccessDeniedPath = new PathString("/Home/AccessDenied"); }) .AddCloudFoundryOAuth(Configuration); // Add Cloud Foundry authentication service ... } - public void Configure(IApplicationBuilder app, ...) + public void Configure(IApplicationBuilder app, ...) { ... - // Use the protocol from the original request when generating redirect uris - // (eg: when TLS termination is handled by an appliance in front of the app) + // Use the protocol from the original request when generating redirect uris + // (eg: when TLS termination is handled by an appliance in front of the app) app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedProto }); - // Add authentication middleware to pipeline + // Add authentication middleware to pipeline app.UseAuthentication(); } ... @@ -191,24 +191,23 @@ ... public class HomeController : Controller { - public IActionResult Index() + public IActionResult Index() { - return View(); + return View(); } [Authorize] - public IActionResult About() + public IActionResult About() { ViewData["Message"] = "Your About page."; - return View(); + return View(); } [Authorize(Policy = "testgroup1")] - public IActionResult Contact() + public IActionResult Contact() { ViewData["Message"] = "Your contact page."; - - return View(); + return View(); } ... } @@ -294,13 +293,13 @@

Configuring settings for the provider beyond what is provided in a service binding is not typically required, but when Cloud Foundry is using self-signed certificates, you might need to disable certificate validation, as shown in the following example:

{
-					"security": {
-					"oauth2": {
-					"client": {
-					"validateCertificates": false
-      }
+    "security": {
+        "oauth2": {
+            "client": {
+                "validateCertificates": false
+            }
+        }
     }
-  }
 }
 
@@ -381,9 +380,9 @@ namespace CloudFoundrySingleSignon { - public partial class Startup + public partial class Startup { - public void Configuration(IAppBuilder app) + public void Configuration(IAppBuilder app) { app.SetDefaultSignInAsAuthenticationType("ExternalCookie"); app.UseCookieAuthentication(new CookieAuthenticationOptions @@ -417,7 +416,7 @@
public void AuthorizeSSO(string returnUrl)
 {
-					var properties = new AuthenticationProperties { RedirectUri = returnUrl ?? Url.Action("Secure", "Home") };
+    var properties = new AuthenticationProperties { RedirectUri = returnUrl ?? Url.Action("Secure", "Home") };
     HttpContext.GetOwinContext().Authentication.Challenge(properties, CloudFoundryDefaults.DisplayName);
 }
 
@@ -430,19 +429,19 @@
internal class ChallengeResult : HttpUnauthorizedResult
 {
-					public ChallengeResult(string authType, string redirectUri)
+    public ChallengeResult(string authType, string redirectUri)
     {
         AuthenticationType = authType;
         RedirectUri = redirectUri;
     }
 
-					public string AuthenticationType { get; set; }
+    public string AuthenticationType { get; set; }
 
-					public string RedirectUri { get; set; }
+    public string RedirectUri { get; set; }
 
-					public override void ExecuteResult(ControllerContext context)
+    public override void ExecuteResult(ControllerContext context)
     {
-					var properties = new AuthenticationProperties { RedirectUri = RedirectUri };
+        var properties = new AuthenticationProperties { RedirectUri = RedirectUri };
         context.HttpContext.GetOwinContext().Authentication.Challenge(properties, AuthenticationType);
     }
 }
@@ -452,7 +451,7 @@
 
 
public ActionResult AuthorizeSSO(string returnUrl)
 {
-					return new ChallengeResult(CloudFoundryDefaults.DisplayName, returnUrl ?? Url.Action("Secure", "Home"));
+    return new ChallengeResult(CloudFoundryDefaults.DisplayName, returnUrl ?? Url.Action("Secure", "Home"));
 }
 
@@ -464,16 +463,16 @@ ... public class HomeController : Controller { - public ActionResult Index() + public ActionResult Index() { - return View(); + return View(); } [Authorize] - public ActionResult Secure() + public ActionResult Secure() { ViewData["Message"] = "This page requires authentication"; - return View(); + return View(); } ... } @@ -486,14 +485,14 @@ public ActionResult TestGroupV1() { ViewBag.Message = "Congratulations, you have access to 'testgroup'"; - return View("Index"); + return View("Index"); } [CustomClaimsAuthorize("testgroup")] public ActionResult TestGroupV2() { ViewBag.Message = "Congratulations, you have access to 'testgroup'"; - return View("Index"); + return View("Index"); }
@@ -537,7 +536,7 @@
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.Security.Authentication.CloudFoundryCore" Version= "2.3.0"/>
+    <PackageReference Include="Steeltoe.Security.Authentication.CloudFoundryCore" Version= "2.3.0"/>
 ...
 </ItemGroup>
 
@@ -547,13 +546,13 @@

Configuring additional settings for the provider is not typically required, but, when Cloud Foundry uses self-signed certificates, you might need to disable certificate validation, as shown in the following example:

{
-					"security": {
-					"oauth2": {
-					"client": {
-					"validateCertificates": false
-      }
+    "security": {
+        "oauth2": {
+            "client": {
+                "validateCertificates": false
+            }
+        }
     }
-  }
 }
 
@@ -594,17 +593,17 @@ public class Startup { ... - public IConfiguration Configuration { get; private set; } - public Startup(IConfiguration configuration) + public IConfiguration Configuration { get; private set; } + public Startup(IConfiguration configuration) { Configuration = configuration; } - public void ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { - // Add Cloud Foundry JWT Authentication service as the default + // Add Cloud Foundry JWT Authentication service as the default services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddCloudFoundryJwtBearer(Configuration); - // Add authorization policies + // Add authorization policies services.AddAuthorization(options => { options.AddPolicy("Orders", policy => policy.RequireClaim("scope", "order.me")); @@ -612,10 +611,10 @@ }); ... } - public void Configure(IApplicationBuilder app, ...) + public void Configure(IApplicationBuilder app, ...) { ... - // Add the authentication middleware to the pipeline + // Add the authentication middleware to the pipeline app.UseAuthentication(); } ... @@ -637,12 +636,12 @@ [Route("api/[controller]")] public class ValuesController : Controller { - // GET api/values + // GET api/values [HttpGet] [Authorize(Policy = "testgroup")] - public IEnumerable<string> Get() + public IEnumerable<string> Get() { - return new string[] { "value1", "value2" }; + return new string[] { "value1", "value2" }; } }
@@ -680,13 +679,13 @@

Configuring additional settings for the provider is not typically required, but, when Cloud Foundry uses self-signed certificates, you might need to disable certificate validation, as shown in the following example:

{
-					"security": {
-					"oauth2": {
-					"client": {
-					"validateCertificates": false
-      }
+    "security": {
+        "oauth2": {
+            "client": {
+                "validateCertificates": false
+            }
+        }
     }
-  }
 }
 
@@ -737,9 +736,9 @@ namespace CloudFoundryJwtAuthentication { - public partial class Startup + public partial class Startup { - public void ConfigureAuth(IAppBuilder app) + public void ConfigureAuth(IAppBuilder app) { app.UseCloudFoundryJwtBearerAuthentication(ApplicationConfig.Configuration); } @@ -761,12 +760,12 @@ public class ValuesController : ApiController { - // GET: api/Values + // GET: api/Values [CustomClaimsAuthorize("testgroup")] - public IEnumerable<string> Get() + public IEnumerable<string> Get() { Console.WriteLine("Received GET Request"); - return new string[] { "value1", "value2" }; + return new string[] { "value1", "value2" }; } }
@@ -803,13 +802,13 @@

Configuring additional settings for the provider is not typically required, but, when Cloud Foundry uses self-signed certificates, you might need to disable certificate validation, as shown in the following example:

{
-					"security": {
-					"oauth2": {
-					"client": {
-					"validateCertificates": false
-      }
+    "security": {
+        "oauth2": {
+            "client": {
+                "validateCertificates": false
+            }
+        }
     }
-  }
 }
 
@@ -868,10 +867,10 @@ public class Global : System.Web.HttpApplication { - protected void Application_Start(object sender, EventArgs e) + protected void Application_Start(object sender, EventArgs e) { ApplicationConfig.RegisterConfig("development"); - var serviceHost = new ServiceHost(typeof(ValueService)); + var serviceHost = new ServiceHost(typeof(ValueService)); serviceHost.AddJwtAuthorization(ApplicationConfig.Configuration); } } @@ -890,12 +889,12 @@ namespace CloudFoundryWcf { - public class ValueService : IValueService + public class ValueService : IValueService { [ScopePermission(SecurityAction.Demand, Scope = "testgroup")] - public string GetData() + public string GetData() { - return "Hello from the WCF Sample!"; + return "Hello from the WCF Sample!"; } } } @@ -945,25 +944,27 @@

Regardless of the method chosen for instantiating the CloudFoundryOptions, the code to apply the behavior should look something like this:

-
    // create an instance of the WCF client
-					var sRef = new ValueService.ValueServiceClient();
+

+    // create an instance of the WCF client
+    var sRef = new ValueService.ValueServiceClient();
 
-					// apply the behavior, expecting it to manage and pass the token for the application
+    // apply the behavior, expecting it to manage and pass the token for the application
     sRef.Endpoint.EndpointBehaviors.Add(new JwtHeaderEndpointBehavior(new CloudFoundryOptions(configuration)));
-					string serviceResponse = await sRef.GetDataAsync();
+    string serviceResponse = await sRef.GetDataAsync();
 

To pass a user’s token (instead of the application’s) to the backing service, first set security:oauth2:client:forwardUserCredentials to true in your configuration. You will also need to retrieve the user’s token and pass that into the JwtHeaderEndpointBehavior when making requests, as seen in this example:

-
    // retrieve the user's token
-					var token = Request.GetOwinContext().Authentication.User.Claims.First(c => c.Type == ClaimTypes.Authentication)?.Value;
+

+    // retrieve the user's token
+    var token = Request.GetOwinContext().Authentication.User.Claims.First(c => c.Type == ClaimTypes.Authentication)?.Value;
 
-					// create an instance of the WCF client
-					var sRef = new ValueService.ValueServiceClient(binding, address);
+    // create an instance of the WCF client
+    var sRef = new ValueService.ValueServiceClient(binding, address);
 
-					// apply the behavior, including the user's token
+    // apply the behavior, including the user's token
     sRef.Endpoint.EndpointBehaviors.Add(new JwtHeaderEndpointBehavior(new CloudFoundryOptions(ApplicationConfig.Configuration), token));
-					string serviceResponse = await sRef.GetDataAsync();
+    string serviceResponse = await sRef.GetDataAsync();
 

4.0 Redis Key Storage Provider

@@ -991,7 +992,7 @@
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.Security.DataProtection.RedisCore" Version= "2.3.0"/>
+    <PackageReference Include="Steeltoe.Security.DataProtection.RedisCore" Version= "2.3.0"/>
 ...
 </ItemGroup>
 
@@ -1002,7 +1003,7 @@
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.CloudFoundry.ConnectorCore" Version= "2.3.0"/>
+    <PackageReference Include="Steeltoe.CloudFoundry.ConnectorCore" Version= "2.3.0"/>
 ...
 </ItemGroup>
 
@@ -1037,17 +1038,17 @@ cf restage myApp public class Startup { ... - public IConfiguration Configuration { get; private set; } - public Startup(IConfiguration configuration) + public IConfiguration Configuration { get; private set; } + public Startup(IConfiguration configuration) { Configuration = configuration; } - public void ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { - // Add StackExchange ConnectionMultiplexer configured from Cloud Foundry + // Add StackExchange ConnectionMultiplexer configured from Cloud Foundry services.AddRedisConnectionMultiplexer(Configuration); - // Add framework services. + // Add framework services. services.AddMvc(); ... } @@ -1066,22 +1067,22 @@ cf restage myApp public class Startup { ... - public IConfiguration Configuration { get; private set; } - public Startup(IConfiguration configuration) + public IConfiguration Configuration { get; private set; } + public Startup(IConfiguration configuration) { Configuration = configuration; } - public void ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { - // Add StackExchange ConnectionMultiplexer configured from Cloud Foundry + // Add StackExchange ConnectionMultiplexer configured from Cloud Foundry services.AddRedisConnectionMultiplexer(Configuration); - // Add DataProtection and persist keys to Cloud Foundry Redis service + // Add DataProtection and persist keys to Cloud Foundry Redis service services.AddDataProtection() .PersistKeysToRedis() .SetApplicationName("Some Name"); - // Add framework services. + // Add framework services. services.AddMvc(); ... } @@ -1122,7 +1123,7 @@ cf restage myApp
<ItemGroup>
 ...
-					<PackageReference Include="Steeltoe.Security.DataProtection.CredHubCore" Version= "2.3.0"/>
+    <PackageReference Include="Steeltoe.Security.DataProtection.CredHubCore" Version= "2.3.0"/>
 ...
 </ItemGroup>
 
@@ -1131,10 +1132,11 @@ cf restage myApp

Settings for this library are expected to have a prefix of CredHubClient. The following example shows what that looks like in JSON:

-
{
+

+{
   ...
-					"credHubClient": {
-					"validateCertificates": "false"
+    "credHubClient": {
+    "validateCertificates": "false"
   }
   ...
 }
@@ -1193,13 +1195,13 @@ cf restage myApp
 public class Startup
 {
     ILoggerFactory logFactory;
-					public Startup(IConfiguration configuration, ILoggerFactory logFactory)
+    public Startup(IConfiguration configuration, ILoggerFactory logFactory)
     {
         Configuration = configuration;
-					this.logFactory = logFactory;
+        this.logFactory = logFactory;
     }
-					public IConfiguration Configuration { get; }
-					public void ConfigureServices(IServiceCollection services)
+    public IConfiguration Configuration { get; }
+    public void ConfigureServices(IServiceCollection services)
     {
         services.AddMvc();
         services.AddCredHubClient(Configuration, logFactory);
@@ -1341,21 +1343,21 @@ cf restage myApp
 					

The following example shows a typical request object for the Interpolate endpoint:

{
-					"p-demo-resource": [
+    "p-demo-resource": [
     {
-					"credentials": {
-					"credhub-ref": "((/config-server/credentials))"
-      },
-					"label": "p-config-server",
-					"name": "config-server",
-					"plan": "standard",
-					"provider": null,
-					"syslog_drain_url": null,
-					"tags": [
-					"configuration",
-					"spring-cloud"
-      ],
-					"volume_mounts": []
+        "credentials": {
+            "credhub-ref": "((/config-server/credentials))"
+        },
+        "label": "p-config-server",
+        "name": "config-server",
+        "plan": "standard",
+        "provider": null,
+        "syslog_drain_url": null,
+        "tags": [
+            "configuration",
+            "spring-cloud"
+        ],
+        "volume_mounts": []
     }
   ]
 }
@@ -1364,28 +1366,28 @@ cf restage myApp
 					

The following example shows a typical response object from the Interpolate endpoint:

{
-					"p-demo-resource": [
-    {
-					"credentials": {
-					"key": 123,
-					"key_list": [
-					"val1",
-					"val2"
-        ],
-					"is_true": true
-      },
-					"label": "p-config-server",
-					"name": "config-server",
-					"plan": "standard",
-					"provider": null,
-					"syslog_drain_url": null,
-					"tags": [
-					"configuration",
-					"spring-cloud"
-      ],
-					"volume_mounts": []
-    }
-  ]
+    "p-demo-resource": [
+        {
+            "credentials": {
+                "key": 123,
+                "key_list": [
+                    "val1",
+                    "val2"
+                ],
+                "is_true": true
+            },
+            "label": "p-config-server",
+            "name": "config-server",
+            "plan": "standard",
+            "provider": null,
+            "syslog_drain_url": null,
+            "tags": [
+                "configuration",
+                "spring-cloud"
+            ],
+            "volume_mounts": []
+        }
+    ]
 }
 
@@ -1655,20 +1657,20 @@ cf push -f manifest-windows.yml -p bin/Debug/net461/
public class Program {
     ...
-					public static IWebHost BuildWebHost(string[] args)
+    public static IWebHost BuildWebHost(string[] args)
     {
-					return new WebHostBuilder()
+        return new WebHostBuilder()
             ...
             .UseCloudFoundryHosting()
             ...
             .ConfigureAppConfiguration((builderContext, configBuilder) =>
             {
-					var env = builderContext.HostingEnvironment;
+                var env = builderContext.HostingEnvironment;
                 configBuilder.SetBasePath(env.ContentRootPath)
                     .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                     .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                     .AddEnvironmentVariables()
-					// Add the Cloudfoundry VCAP settings to configuration
+                    // Add the Cloudfoundry VCAP settings to configuration
                     .AddCloudFoundry();
             })
             .Build();
diff --git a/src/Client/wwwroot/docs/steeltoe-smb/index.html b/src/Client/wwwroot/docs/steeltoe-smb/index.html
index d1dcac9..51ac286 100644
--- a/src/Client/wwwroot/docs/steeltoe-smb/index.html
+++ b/src/Client/wwwroot/docs/steeltoe-smb/index.html
@@ -97,7 +97,7 @@
 
 
using (new WindowsNetworkFileShare(@"\\server\path", new System.Net.NetworkCredential("username", "password")))
 {
-					// Interact with an attached network share here
+    // Interact with an attached network share here
 }
 
@@ -113,15 +113,15 @@
public SomeClassConstructor(IOptions<CloudFoundryServicesOptions> serviceOptions)
 {
-					var userName = serviceOptions.Services["credhub"]
+    var userName = serviceOptions.Services["credhub"]
        .First(q => q.Name.Equals("my-network-share"))
        .Credentials["share-username"].Value;
-					var password = serviceOptions.Services["credhub"]
+    var password = serviceOptions.Services["credhub"]
        .First(q => q.Name.Equals("my-network-share"))
        .Credentials["share-password"].Value;
 
-					// create credential object to pass to WindowsNetworkFileShare
-					var _shareCredential = new NetworkCredential(userName, password);
+    // create credential object to pass to WindowsNetworkFileShare
+    var _shareCredential = new NetworkCredential(userName, password);
 }