1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
| using IdentityServer4; using IdentityServer4.Models; using IdentityServer4.Test; using System.Collections.Generic; using System.Security.Claims;
namespace IdentityServer { public static class Config { public static IEnumerable<IdentityResource> GetIdentityResources() { return new IdentityResource[] { new IdentityResources.OpenId(), new IdentityResources.Profile(), new IdentityResources.Email(), new IdentityResources.Phone(), }; } public static List<TestUser> GetUsers() { return new List<TestUser> { new TestUser { SubjectId = "1", Username = "alice", Password = "password", Claims = new [] { new Claim("name", "Alice"), new Claim("website", "https://alice.com") } }, new TestUser { SubjectId = "2", Username = "bob", Password = "password", Claims = new [] { new Claim("name", "Bob"), new Claim("website", "https://bob.com") } } }; } public static IEnumerable<ApiResource> GetApis() { return new ApiResource[] { new ApiResource ("api1", "My API") }; }
public static IEnumerable<Client> GetClients() { var secret = "49C1A7E1-0C79-4A89-A3D6-A37998FB86B0".Sha256(); return new Client[] { new Client { ClientId = "mvc", ClientName = "MVC Client", ClientSecrets = { new Secret (secret) }, AllowedGrantTypes = GrantTypes.HybridAndClientCredentials, RedirectUris = { "http://localhost:5001/signin-oidc" }, PostLogoutRedirectUris = { "http://localhost:5001/signout-callback-oidc" }, AllowedScopes = new List<string> { IdentityServerConstants.StandardScopes.OpenId, IdentityServerConstants.StandardScopes.Email, IdentityServerConstants.StandardScopes.Phone, IdentityServerConstants.StandardScopes.Profile, "api1" } },, new Client { ClientName = "vuejs", ClientId = "vuejsclient", AllowedGrantTypes=GrantTypes.Implicit, AllowAccessTokensViaBrowser=true, AccessTokenType = AccessTokenType.Reference, UpdateAccessTokenClaimsOnRefresh = true, AllowOfflineAccess = true, RequireConsent = false, RedirectUris = new List<string>() { "http://localhost:5002/static/callback.html", "http://localhost:5002/static/silent-renew.html" }, PostLogoutRedirectUris = { "http://localhost:5002/index.html" }, AllowedCorsOrigins = { "http://localhost:5002" }, AllowedScopes = { IdentityServerConstants.StandardScopes.OpenId, IdentityServerConstants.StandardScopes.Profile, IdentityServerConstants.StandardScopes.Address, "roles", "identityserver4api", "country", "subscriptionlevel" }, ClientSecrets = { new Secret("secret".Sha256()) } } }; } } }
|