Config.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using IdentityServer4;
  2. using IdentityServer4.Models;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Threading.Tasks;
  7. namespace AuthorizeCenter.AuthConfig
  8. {
  9. public class Config
  10. {
  11. // scopes define the resources in your system
  12. public static IEnumerable<IdentityResource> GetIdentityResources()
  13. {
  14. return new List<IdentityResource>
  15. {
  16. new IdentityResources.OpenId(),
  17. new IdentityResources.Profile(),
  18. };
  19. }
  20. // clients want to access resources (aka scopes)
  21. public static IEnumerable<Client> GetClients()
  22. {
  23. return new List<Client>
  24. {
  25. // OpenID Connect隐式流客户端(MVC)
  26. new Client
  27. {
  28. ClientId = "EAP",
  29. ClientName = "EAP Web Client",
  30. AllowedGrantTypes = GrantTypes.Implicit,//隐式方式
  31. RequireConsent=false,//如果不需要显示否同意授权 页面 这里就设置为false
  32. RedirectUris = { "http://localhost:5555/signin-oidc" },//登录成功后返回的客户端地址
  33. PostLogoutRedirectUris = { "http://localhost:5555/signout-callback-oidc" },//注销登录后返回的客户端地址
  34. AllowedScopes =//下面这两个必须要加吧 不太明白啥意思
  35. {
  36. IdentityServerConstants.StandardScopes.OpenId,
  37. IdentityServerConstants.StandardScopes.Profile
  38. }
  39. }
  40. };
  41. }
  42. }
  43. }