我有一個使用IdentityServer4構建的Identity Server。IdentityServer4是否有API來驗證訪問令牌?
我有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應用程序,我可以通過調用方法RequestClientCredentialsAsync與範圍「php.es.api」獲得訪問令牌容易。然後添加此不記名令牌並將請求發送到PHP API。
問題是我不知道IdentityServer4是否有API,以便PHP應用程序可以調用它來驗證訪問令牌。我谷歌,並沒有發現任何關於這個API的文件提及。
是否必須在Identity Server應用程序中爲PHP或其他非.NET應用程序編寫新的API來驗證令牌?
.NET應用程序如下訪問來自PHP應用程序的資源。
我嘗試調用introspect端點,但它始終返回登錄頁面,它不是文檔中的對象IdentityServer4,雖然我的授權類型是ClientCredentials。 –
我還沒有找到一個庫來驗證PHP中的訪問令牌。我暫時使用內省端點,如果我在範圍內添加祕密,它運作良好。非常感謝。 –