Config.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using IdentityServer4.Models;
  2. using IdentityServer4.Test;
  3. using System.Collections.Generic;
  4. namespace CasinosManager.IdentityServer
  5. {
  6. public class Config
  7. {
  8. // scopes define the API resources in your system
  9. public static IEnumerable<ApiResource> GetApiResources()
  10. {
  11. return new List<ApiResource>
  12. {
  13. new ApiResource("CasinosApi", "Casinos API")
  14. };
  15. }
  16. // clients want to access resources (aka scopes)
  17. public static IEnumerable<Client> GetClients()
  18. {
  19. // client credentials client
  20. return new List<Client>
  21. {
  22. // resource owner password grant client
  23. new Client
  24. {
  25. ClientId = "angular.client",
  26. AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,
  27. ClientSecrets =
  28. {
  29. new Secret("secret".Sha256())
  30. },
  31. AllowedScopes = { "CasinosApi" }
  32. }
  33. };
  34. }
  35. public static List<TestUser> GetUsers()
  36. {
  37. return new List<TestUser>
  38. {
  39. new TestUser
  40. {
  41. SubjectId = "1",
  42. Username = "alice",
  43. Password = "password"
  44. },
  45. new TestUser
  46. {
  47. SubjectId = "2",
  48. Username = "bob",
  49. Password = "password"
  50. }
  51. };
  52. }
  53. }
  54. }