Skip to content

Instantly share code, notes, and snippets.

@xivk
Created December 12, 2017 11:43
Show Gist options
  • Save xivk/f7bb3dc3ac4e56442834af98e37ae9ce to your computer and use it in GitHub Desktop.
Save xivk/f7bb3dc3ac4e56442834af98e37ae9ce to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Nancy.Owin;
using Microsoft.Extensions.Configuration;
namespace Anyways.Nancy.API
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvcCore()
.AddAuthorization()
.AddJsonFormatters();
services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
options.Authority = "http://localhost:5000";
options.RequireHttpsMetadata = false;
options.ApiName = "osmApi";
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseAuthentication();
app.UseOwin(x => x.UseNancy());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment