Skip to content

Commit

Permalink
all grant types config
Browse files Browse the repository at this point in the history
  • Loading branch information
anjoy8 committed Nov 18, 2020
1 parent 6291ca9 commit 0dde6ae
Show file tree
Hide file tree
Showing 6 changed files with 418 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Blog.IdentityServer.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.136
# Visual Studio Version 16
VisualStudioVersion = 16.0.30427.197
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blog.IdentityServer", "Blog.IdentityServer\Blog.IdentityServer.csproj", "{1DB65298-136C-41BC-B2CD-BA5BBA3D7A23}"
EndProject
Expand Down
28 changes: 28 additions & 0 deletions Blog.IdentityServer/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,34 @@ public static IEnumerable<Client> GetClients()
// where to redirect to after logout
PostLogoutRedirectUris = { "https://mvp.neters.club/signout-callback-oidc" },

AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
"roles",
"rolename",
"blog.core.api"
}
},

// 7、测试 hybrid 模式
new Client
{
ClientId = "hybridclent",
ClientName="Demo MVC Client",
ClientSecrets = { new Secret("secret".Sha256()) },

AllowedGrantTypes = GrantTypes.Hybrid,

RequirePkce = false,

RedirectUris = { "http://localhost:1003/signin-oidc" },
PostLogoutRedirectUris = { "http://localhost:1003/signout-callback-oidc" },

AllowOfflineAccess=true,
AlwaysIncludeUserClaimsInIdToken=true,

AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
Expand Down
8 changes: 8 additions & 0 deletions Blog.IdentityServer/Controllers/Grants/GrantsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,13 @@ private async Task<GrantsViewModel> BuildViewModelAsync()
Grants = list
};
}


[HttpGet]
[AllowAnonymous]
public IActionResult Config()
{
return View();
}
}
}
Loading

0 comments on commit 0dde6ae

Please sign in to comment.