|
1 | | -using Microsoft.AspNetCore.Authentication.JwtBearer; |
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.IdentityModel.Tokens.Jwt; |
| 4 | +using System.Net.Http; |
| 5 | +using Microsoft.AspNetCore.Authentication.JwtBearer; |
2 | 6 | using Microsoft.AspNetCore.Builder; |
3 | 7 | using Microsoft.AspNetCore.Hosting; |
4 | 8 | using Microsoft.AspNetCore.Http; |
|
12 | 16 | using Polly; |
13 | 17 | using Polly.Extensions.Http; |
14 | 18 | using Swashbuckle.AspNetCore.Swagger; |
15 | | -using System; |
16 | | -using System.Collections.Generic; |
17 | | -using System.IdentityModel.Tokens.Jwt; |
18 | | -using System.Net.Http; |
19 | 19 |
|
20 | 20 | namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator |
21 | 21 | { |
@@ -61,7 +61,11 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF |
61 | 61 | app.UseSwagger().UseSwaggerUI(c => |
62 | 62 | { |
63 | 63 | c.SwaggerEndpoint($"{ (!string.IsNullOrEmpty(pathBase) ? pathBase : string.Empty) }/swagger/v1/swagger.json", "Purchase BFF V1"); |
64 | | - c.ConfigureOAuth2("Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregatorwaggerui", "", "", "Purchase BFF Swagger UI"); |
| 64 | + |
| 65 | + c.OAuthClientId("Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregatorwaggerui"); |
| 66 | + c.OAuthClientSecret(string.Empty); |
| 67 | + c.OAuthRealm(string.Empty); |
| 68 | + c.OAuthAppName("Purchase BFF Swagger UI"); |
65 | 69 | }); |
66 | 70 | } |
67 | 71 | } |
@@ -130,11 +134,9 @@ public static IServiceCollection AddCustomAuthentication(this IServiceCollection |
130 | 134 | { |
131 | 135 | OnAuthenticationFailed = async ctx => |
132 | 136 | { |
133 | | - int i = 0; |
134 | 137 | }, |
135 | 138 | OnTokenValidated = async ctx => |
136 | 139 | { |
137 | | - int i = 0; |
138 | 140 | } |
139 | 141 | }; |
140 | 142 | }); |
@@ -166,15 +168,16 @@ public static IServiceCollection AddHttpServices(this IServiceCollection service |
166 | 168 | return services; |
167 | 169 | } |
168 | 170 |
|
169 | | - static IAsyncPolicy<HttpResponseMessage> GetRetryPolicy() |
| 171 | + private static IAsyncPolicy<HttpResponseMessage> GetRetryPolicy() |
170 | 172 | { |
171 | 173 | return HttpPolicyExtensions |
172 | 174 | .HandleTransientHttpError() |
173 | 175 | .OrResult(msg => msg.StatusCode == System.Net.HttpStatusCode.NotFound) |
174 | 176 | .WaitAndRetryAsync(6, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt))); |
175 | 177 |
|
176 | 178 | } |
177 | | - static IAsyncPolicy<HttpResponseMessage> GetCircuitBreakerPolicy() |
| 179 | + |
| 180 | + private static IAsyncPolicy<HttpResponseMessage> GetCircuitBreakerPolicy() |
178 | 181 | { |
179 | 182 | return HttpPolicyExtensions |
180 | 183 | .HandleTransientHttpError() |
|
0 commit comments