Browse Source

update function version

jkotalik/newVotingSample
Justin Kotalik 6 years ago
parent
commit
26f94e3483
  1. 8
      samples/azure-functions/voting/IdentityServer/Startup.cs
  2. 26
      samples/azure-functions/voting/results/Startup.cs

8
samples/azure-functions/voting/IdentityServer/Startup.cs

@ -60,13 +60,11 @@ namespace IdentityServer
AllowedGrantTypes = GrantTypes.Code,
// These currently break when ingress is in place for redirect.
RedirectUris = { $"http://40.91.74.200/results/signin-oidc" },
FrontChannelLogoutUri = $"http://40.91.74.200/results/signout-oidc",
PostLogoutRedirectUris = { $"http://40.91.74.200/results/signout-callback-oidc" },
RedirectUris = { $"{Configuration.GetServiceUri("results:http")}signin-oidc" },
FrontChannelLogoutUri = $"{Configuration.GetServiceUri("results:http")}signout-oidc",
PostLogoutRedirectUris = { $"{Configuration.GetServiceUri("results:http")}signout-callback-oidc" },
AllowOfflineAccess = true,
// AllowedCorsOrigins = { $"{Configuration.GetServiceUri("results")}" },
AllowedScopes = new List<string>{IdentityServerConstants.StandardScopes.OpenId,IdentityServerConstants.StandardScopes.Profile, "scope"}
},
});

26
samples/azure-functions/voting/results/Startup.cs

@ -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");
});
}

Loading…
Cancel
Save