-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
258 changed files
with
101,338 additions
and
0 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,37 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.31321.278 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdentityServer", "IdentityServer\IdentityServer.csproj", "{AD6BBF25-D09F-4414-AFCA-2C86CEB683B7}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeatherApi", "WeatherApi\WeatherApi.csproj", "{CE8550B6-63A5-4108-8CD8-739FE64FEAD0}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeatherMVC", "WeatherMVC\WeatherMVC.csproj", "{1E133DD9-FF3E-4719-B83E-97529DFE342F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{AD6BBF25-D09F-4414-AFCA-2C86CEB683B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{AD6BBF25-D09F-4414-AFCA-2C86CEB683B7}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{AD6BBF25-D09F-4414-AFCA-2C86CEB683B7}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{AD6BBF25-D09F-4414-AFCA-2C86CEB683B7}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{CE8550B6-63A5-4108-8CD8-739FE64FEAD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{CE8550B6-63A5-4108-8CD8-739FE64FEAD0}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{CE8550B6-63A5-4108-8CD8-739FE64FEAD0}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{CE8550B6-63A5-4108-8CD8-739FE64FEAD0}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{1E133DD9-FF3E-4719-B83E-97529DFE342F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{1E133DD9-FF3E-4719-B83E-97529DFE342F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{1E133DD9-FF3E-4719-B83E-97529DFE342F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{1E133DD9-FF3E-4719-B83E-97529DFE342F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {34F4CE00-0972-4E7A-9359-93FBD04EF649} | ||
EndGlobalSection | ||
EndGlobal |
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,131 @@ | ||
using System.Collections.Generic; | ||
using System.Security.Claims; | ||
using System.Text.Json; | ||
using IdentityModel; | ||
using IdentityServer4; | ||
using IdentityServer4.Models; | ||
using IdentityServer4.Test; | ||
|
||
namespace IdentityServer | ||
{ | ||
public static class Config | ||
{ | ||
public static List<TestUser> Users | ||
{ | ||
get | ||
{ | ||
var address = new | ||
{ | ||
street_address = "One Hacker Way", | ||
locality = "Heidelberg", | ||
postal_code = 123456, | ||
country = "Russia" | ||
}; | ||
|
||
|
||
return new List<TestUser> | ||
{ | ||
new TestUser | ||
{ | ||
SubjectId = "818727", | ||
Username = "developer", | ||
Password = "developer", | ||
Claims = | ||
{ | ||
new Claim(JwtClaimTypes.Name, value: "Identity Developer"), | ||
new Claim(JwtClaimTypes.GivenName, value: "Developer"), | ||
new Claim(JwtClaimTypes.FamilyName, value: "Developer"), | ||
new Claim(JwtClaimTypes.Email, value: "developer@identity.com"), | ||
new Claim(JwtClaimTypes.EmailVerified, value: ClaimValueTypes.Boolean), | ||
new Claim(JwtClaimTypes.Role, value: "admin"), | ||
new Claim(JwtClaimTypes.WebSite, value: "http://developer.com"), | ||
new Claim(JwtClaimTypes.Address, value: JsonSerializer.Serialize(address), | ||
valueType: IdentityServerConstants.ClaimValueTypes.Json) | ||
} | ||
}, | ||
new TestUser | ||
{ | ||
SubjectId = "88421113", | ||
Username = "user", | ||
Password = "user", | ||
Claims = | ||
{ | ||
new Claim(JwtClaimTypes.Name, value: "Identity User"), | ||
new Claim(JwtClaimTypes.GivenName, value: "User"), | ||
new Claim(JwtClaimTypes.FamilyName, value: "User"), | ||
new Claim(JwtClaimTypes.Email, value: "User@identity.com"), | ||
new Claim(JwtClaimTypes.EmailVerified, value: ClaimValueTypes.Boolean), | ||
new Claim(JwtClaimTypes.Role, value: "User"), | ||
new Claim(JwtClaimTypes.WebSite, value: "http://User.com"), | ||
new Claim(JwtClaimTypes.Address, value: JsonSerializer.Serialize(address), | ||
valueType: IdentityServerConstants.ClaimValueTypes.Json) | ||
} | ||
}, | ||
}; | ||
} | ||
} | ||
|
||
public static IEnumerable<IdentityResource> IdentityResources => | ||
new[] | ||
{ | ||
new IdentityResources.OpenId(), | ||
new IdentityResources.Profile(), | ||
new IdentityResource | ||
{ | ||
Name = "role", | ||
UserClaims = new List<string> {"role"} | ||
} | ||
}; | ||
|
||
public static IEnumerable<ApiScope> ApiScopes => new[] | ||
{ | ||
new ApiScope("weatherapi.read"), | ||
new ApiScope("weatherapi.write"), | ||
}; | ||
|
||
public static IEnumerable<ApiResource> ApiResources => new[] | ||
{ | ||
new ApiResource("weatherapi") | ||
{ | ||
Scopes = new List<string> { "weatherapi.read", "weatherapi.write"}, | ||
ApiSecrets = new List<Secret> {new Secret("ScopeSecret".Sha256())}, | ||
UserClaims = new List<string> {"role"} | ||
} | ||
}; | ||
|
||
public static IEnumerable<Client> Clients | ||
{ | ||
get | ||
{ | ||
return new List<Client> | ||
{ | ||
// machine to machine (m2m) client | ||
new Client | ||
{ | ||
ClientId = "m2m.client", | ||
ClientName = "Client Credentials Client", | ||
|
||
AllowedGrantTypes = GrantTypes.ClientCredentials, | ||
ClientSecrets = { new Secret("SuperPassword".Sha256())}, | ||
|
||
AllowedScopes = {"weatherapi.read", "weatherapi.write"} | ||
}, | ||
new Client | ||
{ | ||
ClientId = "interactive", | ||
ClientSecrets = { new Secret("SuperPassword".Sha256())}, | ||
|
||
AllowedGrantTypes = GrantTypes.Code, | ||
|
||
RedirectUris = {"https://localhost:5444/signin-oidc"}, | ||
FrontChannelLogoutUri = "https://localhost:5444/signout-oidc", | ||
PostLogoutRedirectUris = {"http://localhost:5444/signout-callback-oidc"}, | ||
|
||
AllowOfflineAccess = true, | ||
AllowedScopes = {"openid","profile","weatherapi.read"} | ||
} | ||
}; | ||
} | ||
} | ||
} | ||
} |
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 @@ | ||
using Microsoft.AspNetCore.Identity.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace IdentityServer.Data | ||
{ | ||
public class ApplicationDbContext : IdentityDbContext | ||
{ | ||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) | ||
: base(options) | ||
{ | ||
} | ||
} | ||
} |
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,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="IdentityServer4" Version="4.1.2" /> | ||
<PackageReference Include="IdentityServer4.AspNetIdentity" Version="4.1.2" /> | ||
<PackageReference Include="IdentityServer4.EntityFramework" Version="4.1.2" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.7" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.7" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.7" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.7"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
126 changes: 126 additions & 0 deletions
126
IdentityServer/Migrations/20210706141932_InitialIdentityServerMigration.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.