Skip to content

Instantly share code, notes, and snippets.

@dealproc
Created March 5, 2018 03:26
Show Gist options
  • Save dealproc/a47f8c17a0cb5364abc71238403fafe4 to your computer and use it in GitHub Desktop.
Save dealproc/a47f8c17a0cb5364abc71238403fafe4 to your computer and use it in GitHub Desktop.
oauth config bits
/// <summary>
/// </summary>
/// <param name="app"></param>
/// <param name="env"></param>
/// <param name="loggerFactory"></param>
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
if (env.IsDevelopment())
{
loggerFactory.AddDebug();
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "AdaptPOS TMS microservice API");
});
}
app.UseForwardedHeaders(new ForwardedHeadersOptions()
{
ForwardedHeaders = ForwardedHeaders.All
});
app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
Authority = "identity server hostname",
#if DEBUG
RequireHttpsMetadata = false,
#endif
AllowedScopes = new []{ "your api scope name" },
ApiSecret = "{your api secret}",
ApiName = "{your api scope name}"
});
app.UseMvc();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment