55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
namespace Jambo.Auth.UI
|
|
{
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
public class Startup
|
|
{
|
|
public Startup(IConfiguration configuration)
|
|
{
|
|
Configuration = configuration;
|
|
}
|
|
|
|
public IConfiguration Configuration { get; }
|
|
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddMvc();
|
|
|
|
services.AddSwaggerGen(options =>
|
|
{
|
|
options.DescribeAllEnumsAsStrings();
|
|
options.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info
|
|
{
|
|
Title = "Auth API",
|
|
Version = "v1",
|
|
Description = "The Auth API",
|
|
TermsOfService = "Terms Of Service"
|
|
});
|
|
});
|
|
|
|
services.AddScoped(
|
|
s => new UI.Config(Configuration.GetSection("Security").GetValue<string>("SecretKey"),
|
|
Configuration.GetSection("Security").GetValue<string>("Issuer")));
|
|
}
|
|
|
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
|
{
|
|
if (env.IsDevelopment())
|
|
{
|
|
app.UseDeveloperExceptionPage();
|
|
}
|
|
|
|
app.UseMvc();
|
|
|
|
app.UseSwagger()
|
|
.UseSwaggerUI(c =>
|
|
{
|
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
|
|
});
|
|
}
|
|
}
|
|
}
|