Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.user
*.userosscache
*.sln.docstates
profile.arm.json

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
23 changes: 0 additions & 23 deletions IdentityServer/Program.cs

This file was deleted.

2 changes: 1 addition & 1 deletion IdentityServer.sln → OnPlatform.IdentityServer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32611.2
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IdentityServer", "IdentityServer\IdentityServer.csproj", "{3D7032E7-AB9D-47E2-911F-8416E5647566}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnPlatform.IdentityServer", "OnPlatform.IdentityServer\OnPlatform.IdentityServer.csproj", "{3D7032E7-AB9D-47E2-911F-8416E5647566}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
47 changes: 47 additions & 0 deletions OnPlatform.IdentityServer/Configuration/Clients.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using IdentityServer4;
using IdentityServer4.Models;

namespace OnPlatform.IdentityServer.Configuration
{
public class Clients
{
public static IEnumerable<Client> Get()
{
return new List<Client>
{
new Client
{
ClientId = "onShoppingApi",
ClientName = "ASP.NET Core OnShopping Api",
AllowedGrantTypes = GrantTypes.ClientCredentials,
ClientSecrets = new List<Secret> {new Secret("OnPlatform".Sha256())},
AllowedScopes = new List<string> { "onShoppingApi.read" }
},
new Client
{
ClientId = "onShoppingAuth",
ClientName = "OnShopping Mobile App",
ClientSecrets = new List<Secret> {new Secret("OnPlatform".Sha256())},

AllowedGrantTypes = GrantTypes.Code,
RedirectUris = new List<string> {"onshopping:/authenticated"},
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
"role",
"onShoppingApi.read"
},
PostLogoutRedirectUris = new List<string>
{
"onshopping:/signout-callback-oidc",
},

RequirePkce = true,
AllowPlainTextPkce = false
}
};
}
}
}
38 changes: 38 additions & 0 deletions OnPlatform.IdentityServer/Configuration/Resources.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using IdentityServer4.Models;

namespace OnPlatform.IdentityServer.Configuration
{
public class Resources
{
public static IEnumerable<IdentityResource> GetIdentityResources()
{
return new[]
{
new IdentityResources.OpenId(),
new IdentityResources.Profile(),
new IdentityResources.Email(),
new IdentityResource
{
Name = "role",
UserClaims = new List<string> {"role"}
}
};
}

public static IEnumerable<ApiResource> GetApiResources()
{
return new[]
{
new ApiResource
{
Name = "onShoppingApi",
DisplayName = "OnShopping Api",
Description = "Allow the application to access OnShopping Api on your behalf",
Scopes = new List<string> { "onShoppingApi.read", "onShoppingApi.write"},
ApiSecrets = new List<Secret> {new Secret("OnPlatform".Sha256())},
UserClaims = new List<string> {"role"}
}
};
}
}
}
16 changes: 16 additions & 0 deletions OnPlatform.IdentityServer/Configuration/Scopes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using IdentityServer4.Models;

namespace OnPlatform.IdentityServer.Configuration
{
public class Scopes
{
public static IEnumerable<ApiScope> GetApiScopes()
{
return new[]
{
new ApiScope("onShoppingApi.read", "Read Access to OnShopping Api"),
new ApiScope("onShoppingApi.write", "Write Access to OnShopping Api"),
};
}
}
}
28 changes: 28 additions & 0 deletions OnPlatform.IdentityServer/Configuration/Users.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using IdentityModel;
using IdentityServer4.Test;
using System.Security.Claims;

namespace OnPlatform.IdentityServer.Configuration
{
public class Users
{
public static List<TestUser> Get()
{
return new List<TestUser>
{
new TestUser
{
SubjectId = "56892347",
Username = "procoder",
Password = "password",
Claims = new List<Claim>
{
new Claim(JwtClaimTypes.Email, "support@procodeguide.com"),
new Claim(JwtClaimTypes.Role, "admin"),
new Claim(JwtClaimTypes.WebSite, "https://procodeguide.com")
}
}
};
}
}
}
Loading