Skip to content

Commit

Permalink
Changed IdentityServer configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Kulik committed Jul 25, 2019
1 parent ea21fd2 commit b9e6bf0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading.Tasks;
using IdentityServer4WebApp.Data;
using IdentityServer4WebApp.Models;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
Expand Down Expand Up @@ -31,7 +32,11 @@ public void ConfigureServices(IServiceCollection services)
Configuration.GetConnectionString("DefaultConnection")));
services.AddDefaultIdentity<ApplicationUser>()
.AddEntityFrameworkStores<ApplicationDbContext>();
services.AddIdentityServer()
.AddApiAuthorization<ApplicationUser, ApplicationDbContext>();

services.AddAuthentication()
.AddIdentityServerJwt();

services.AddRazorPages();
}
Expand All @@ -58,6 +63,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseAuthentication();
app.UseAuthorization();

app.UseIdentityServer();

app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
Expand Down
5 changes: 5 additions & 0 deletions src/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"System": "Information",
"Microsoft": "Information"
}
},
"IdentityServer": {
"Key": {
"Type": "Development"
}
}
}
7 changes: 7 additions & 0 deletions src/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,12 @@
"ConnectionStrings": {
"DefaultConnection": "Data Source=data.db"
},
"IdentityServer": {
"Clients": {
"TestIdentityAngular": {
"Profile": "IdentityServerSPA"
}
}
},
"AllowedHosts": "*"
}

0 comments on commit b9e6bf0

Please sign in to comment.