Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e1a36a
commit bd16e1c
Showing
64 changed files
with
21,230 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.App" /> | ||
<PackageReference Include="IdentityServer4" Version="2.3.0" /> | ||
|
||
<PackageReference Include="Serilog" Version="2.7.1" /> | ||
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" /> | ||
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" /> | ||
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using IdentityServer4.Models; | ||
using System.Collections.Generic; | ||
|
||
namespace AuthorizationServer | ||
{ | ||
public static class Config | ||
{ | ||
public static IEnumerable<IdentityResource> GetIdentityResources() | ||
{ | ||
return new IdentityResource[] | ||
{ | ||
new IdentityResources.OpenId(), | ||
new IdentityResources.Profile(), | ||
}; | ||
} | ||
|
||
public static IEnumerable<ApiResource> GetApis() | ||
{ | ||
return new ApiResource[] | ||
{ | ||
new ApiResource("api1", "API #1") | ||
{ | ||
Scopes = | ||
{ | ||
new Scope("api1.read"), | ||
new Scope("api1.write") | ||
} | ||
} | ||
}; | ||
} | ||
|
||
public static IEnumerable<Client> GetClients() | ||
{ | ||
return new Client[] | ||
{ | ||
new Client | ||
{ | ||
ClientId = "ktor_app", | ||
AllowedGrantTypes = GrantTypes.Code, | ||
AllowedScopes = {"api1.read", "api1.write"}, | ||
ClientSecrets = {new Secret("super_secret".Sha256())}, | ||
RedirectUris = {"http://localhost:8080/callback"} | ||
} | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. | ||
|
||
|
||
using Microsoft.AspNetCore; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Serilog; | ||
using Serilog.Events; | ||
using Serilog.Sinks.SystemConsole.Themes; | ||
using System; | ||
|
||
namespace AuthorizationServer | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
Console.Title = "IdentityServer4"; | ||
|
||
CreateWebHostBuilder(args).Build().Run(); | ||
} | ||
|
||
public static IWebHostBuilder CreateWebHostBuilder(string[] args) | ||
{ | ||
return WebHost.CreateDefaultBuilder(args) | ||
.UseStartup<Startup>() | ||
.UseSerilog((context, configuration) => | ||
{ | ||
configuration | ||
.MinimumLevel.Debug() | ||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning) | ||
.MinimumLevel.Override("System", LogEventLevel.Warning) | ||
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information) | ||
.Enrich.FromLogContext() | ||
.WriteTo.File(@"identityserver4_log.txt") | ||
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Literate); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"iisSettings": { | ||
"windowsAuthentication": false, | ||
"anonymousAuthentication": true, | ||
"iisExpress": { | ||
"applicationUrl": "http://localhost:5000/", | ||
"sslPort": 0 | ||
} | ||
}, | ||
"profiles": { | ||
"AuthorizationServer": { | ||
"commandName": "Project", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
}, | ||
"applicationUrl": "http://localhost:5000" | ||
} | ||
} | ||
} |
Oops, something went wrong.