Skip to content

Commit 221b6bf

Browse files
committed
Initial OWIN 4.1 implementation
1 parent adcbcad commit 221b6bf

File tree

125 files changed

+65785
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+65785
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3+
4+
5+
using IdentityServer4.Models;
6+
using System.Collections.Generic;
7+
8+
namespace IdentityServer
9+
{
10+
public static class Config
11+
{
12+
public static IEnumerable<IdentityResource> Ids =>
13+
new IdentityResource[]
14+
{
15+
new IdentityResources.OpenId(),
16+
new IdentityResources.Profile(),
17+
};
18+
19+
20+
public static IEnumerable<ApiResource> Apis =>
21+
new ApiResource[]
22+
{
23+
new ApiResource("api1", "My API #1")
24+
};
25+
26+
27+
public static IEnumerable<Client> Clients =>
28+
new[]
29+
{
30+
// old hybrid settings
31+
new Client
32+
{
33+
ClientId = "mvc.owin",
34+
ClientName = "MVC Client",
35+
AllowedGrantTypes = GrantTypes.Hybrid,
36+
ClientSecrets = {new Secret("secret".Sha256())},
37+
RedirectUris = {"http://localhost:5001/"},
38+
AllowedScopes = {"openid", "profile", "api1"}
39+
}
40+
};
41+
}
42+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="IdentityServer4" Version="3.0.1" />
9+
10+
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="3.0.0" />
11+
12+
<PackageReference Include="Serilog" Version="2.9.0" />
13+
<PackageReference Include="Serilog.AspNetCore" Version="3.1.0" />
14+
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
15+
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
16+
</ItemGroup>
17+
18+
</Project>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3+
4+
5+
using Microsoft.AspNetCore.Hosting;
6+
using Microsoft.Extensions.Hosting;
7+
using Serilog;
8+
using Serilog.Events;
9+
using Serilog.Sinks.SystemConsole.Themes;
10+
using System;
11+
12+
namespace IdentityServer
13+
{
14+
public class Program
15+
{
16+
public static int Main(string[] args)
17+
{
18+
Log.Logger = new LoggerConfiguration()
19+
.MinimumLevel.Debug()
20+
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
21+
.MinimumLevel.Override("System", LogEventLevel.Warning)
22+
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
23+
.Enrich.FromLogContext()
24+
// uncomment to write to Azure diagnostics stream
25+
//.WriteTo.File(
26+
// @"D:\home\LogFiles\Application\identityserver.txt",
27+
// fileSizeLimitBytes: 1_000_000,
28+
// rollOnFileSizeLimit: true,
29+
// shared: true,
30+
// flushToDiskInterval: TimeSpan.FromSeconds(1))
31+
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Literate)
32+
.CreateLogger();
33+
34+
try
35+
{
36+
Log.Information("Starting host...");
37+
CreateHostBuilder(args).Build().Run();
38+
return 0;
39+
}
40+
catch (Exception ex)
41+
{
42+
Log.Fatal(ex, "Host terminated unexpectedly.");
43+
return 1;
44+
}
45+
finally
46+
{
47+
Log.CloseAndFlush();
48+
}
49+
}
50+
51+
public static IHostBuilder CreateHostBuilder(string[] args) =>
52+
Host.CreateDefaultBuilder(args)
53+
.ConfigureWebHostDefaults(webBuilder =>
54+
{
55+
webBuilder.UseStartup<Startup>();
56+
webBuilder.UseSerilog();
57+
});
58+
}
59+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:5000/",
7+
"sslPort": 0
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"environmentVariables": {
15+
"ASPNETCORE_ENVIRONMENT": "Development"
16+
}
17+
},
18+
"SelfHost": {
19+
"commandName": "Project",
20+
"launchBrowser": true,
21+
"environmentVariables": {
22+
"ASPNETCORE_ENVIRONMENT": "Development"
23+
},
24+
"applicationUrl": "http://localhost:5000"
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)