【发布时间】:2017-05-14 11:59:50
【问题描述】:
我有一个使用 IdentityServer4 构建的身份服务器。
我有 2 个应用程序(1 个 .NET,1 个 PHP)相互访问资源并使用此 Identity Server 验证请求标头中的访问令牌。
在 Identity Server 应用程序中,我添加了一个客户端配置,如下所示
clients.Add(
new Client
{
ClientId = "myClientId",
ClientName = "My Client Name",
ClientSecrets = new List<Secret>
{
new Secret("secret".Sha256())
},
AllowedGrantTypes = GrantTypes.ClientCredentials,
AllowedScopes = new List<string>
{
"php.es.api"
}
});
从 .NET 应用程序中,我可以通过调用范围为“php.es.api”的方法 RequestClientCredentialsAsync 轻松获取访问令牌。然后添加此不记名令牌并向 PHP API 发送请求。
问题是我不知道 IdentityServer4 是否有 API,以便 PHP 应用程序可以调用它来验证访问令牌。我用谷歌搜索并没有找到任何关于这个 API 的文档。
我是否必须在 Identity Server 应用程序中为 PHP 或其他非 .NET 应用程序编写新的 API 来验证令牌?
.NET 应用程序从 PHP 应用程序访问资源,如下所示。
【问题讨论】:
标签: c# php .net identityserver4