|
|
|
@ -1,5 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.IdentityModel.Tokens.Jwt; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
@ -25,8 +26,29 @@ namespace Results |
|
|
|
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
|
|
|
public void ConfigureServices(IServiceCollection services) |
|
|
|
{ |
|
|
|
services.AddAuthorization(o => o.FallbackPolicy = o.DefaultPolicy); |
|
|
|
|
|
|
|
services.AddRazorPages(); |
|
|
|
services.AddServerSideBlazor(); |
|
|
|
|
|
|
|
|
|
|
|
JwtSecurityTokenHandler.DefaultMapInboundClaims = false; |
|
|
|
|
|
|
|
services.AddAuthentication(options => |
|
|
|
{ |
|
|
|
options.DefaultScheme = "Cookies"; |
|
|
|
options.DefaultChallengeScheme = "oidc"; |
|
|
|
}) |
|
|
|
.AddCookie("Cookies") |
|
|
|
.AddOpenIdConnect("oidc", options => |
|
|
|
{ |
|
|
|
options.Authority = $"{Configuration.GetServiceUri("identityserver:http")}"; |
|
|
|
options.ClientId = "interactive"; |
|
|
|
options.ClientSecret = "49C1A7E1-0C79-4A89-A3D6-A37998FB86B0"; |
|
|
|
options.ResponseType = "code"; |
|
|
|
options.SaveTokens = true; |
|
|
|
options.RequireHttpsMetadata = false; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|
|
|
@ -44,10 +66,12 @@ namespace Results |
|
|
|
app.UseStaticFiles(); |
|
|
|
|
|
|
|
app.UseRouting(); |
|
|
|
app.UseAuthentication(); |
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
|
|
app.UseEndpoints(endpoints => |
|
|
|
{ |
|
|
|
endpoints.MapBlazorHub(); |
|
|
|
endpoints.MapBlazorHub().RequireAuthorization(); |
|
|
|
endpoints.MapFallbackToPage("/_Host"); |
|
|
|
}); |
|
|
|
} |
|
|
|
|