mirror of
https://github.com/nsnail/IGeekFan.AspNetCore.Knife4jUI.git
synced 2025-04-19 11:02:52 +08:00
60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
using System.Collections.Generic;
|
|
using IdentityServer4.Models;
|
|
using IdentityServer4.Test;
|
|
|
|
namespace OAuth2Integration.AuthServer
|
|
{
|
|
public static class Config
|
|
{
|
|
internal static IEnumerable<Client> Clients()
|
|
{
|
|
yield return new Client
|
|
{
|
|
ClientId = "test-id",
|
|
ClientName = "Test client (Code with PKCE)",
|
|
|
|
RedirectUris = new[] {
|
|
"http://localhost:55202/resource-server/swagger/oauth2-redirect.html", // IIS Express
|
|
"http://localhost:5000/resource-server/swagger/oauth2-redirect.html", // Kestrel
|
|
"http://localhost:5000/oauth/oauth2.html", // Kestrel
|
|
"http://localhost:8080/oauth/oauth2.html", // Kestrel
|
|
},
|
|
|
|
ClientSecrets = { new Secret("test-secret".Sha256()) },
|
|
RequireConsent = true,
|
|
|
|
AllowedGrantTypes = GrantTypes.Code,
|
|
RequirePkce = false,
|
|
//AllowedScopes = new[] { "readAccess", "writeAccess" },
|
|
};
|
|
}
|
|
|
|
internal static IEnumerable<ApiResource> ApiResources()
|
|
{
|
|
yield return new ApiResource
|
|
{
|
|
Name = "api",
|
|
DisplayName = "API",
|
|
Scopes = new[]
|
|
{
|
|
new Scope("readAccess", "Access read operations"),
|
|
new Scope("writeAccess", "Access write operations")
|
|
}
|
|
};
|
|
}
|
|
|
|
internal static List<TestUser> TestUsers()
|
|
{
|
|
return new List<TestUser>
|
|
{
|
|
new TestUser
|
|
{
|
|
SubjectId = "joebloggs",
|
|
Username = "joebloggs",
|
|
Password = "pass123"
|
|
}
|
|
};
|
|
}
|
|
}
|
|
}
|