上传 public 证书后,customKeyIdentifier 值无法用作 x5t
customKeyIdentifier value not working as x5t after uploading public certificate
我正在尝试使用 Certificate credentials for application authentication. 从 Microsoft Azure Active Directory 获取 JWT 令牌 我正在使用 customKeyIdentifier 值作为 x5t在生成 JWT 令牌时)
有两种创建应用程序的方法
1) App Registrations(Legacy)
2) App Registrations
从以上两个位置中的任何一个创建应用程序 test-app-13 后。
我从下面的两个路径上传了相同的 public 证书文件以获取
自定义密钥标识符.
1) AzureActiveDirectory->AppRegistrations(Legacy)->test-app-13->Settings->Keys->Upload public key
header = {
"alg": "RS256",
"typ": "JWT",
"x5t": "oO/ImH7U2wcypCvrY+iYalHOOmg="
};
当我使用 "x5t": "oO/ImH7U2wcypCvrY+iYalHOOmg=" 时,身份验证有效。
2) AzureActiveDirectory-> AppRegistrations -> test-app-13-> 证书和机密 -> 上传证书
header = {
"alg": "RS256",
"typ": "JWT",
"x5t": "A0EFC8987ED4DB0732A42BEB63E8986A51CE3A68"
};
但是当我使用 "x5t": "A0EFC8987ED4DB0732A42BEB63E8986A51CE3A68" 时,我不断收到错误消息
{
"error":"invalid_client",
"error_description":"AADSTS700027: Client assertion contains an invalid
signature. [Reason - The key was not found., Thumbprint of key used by
client:
'0341050BCF7CEC40F80C1D3BDF6038D81101EB713CF7CE80E75084DC0EBC', Please
visit 'https://developer.microsoft.com/en-us/graph/graph-explorer'
and query for
'https://graph.microsoft.com/beta/applications/2e452b20-df6d-4228-
83c6-5742b1a8f59c' to see configured keys]\r\nTrace ID: 0a77a624-
684d-4145-9ce5-d19e1b6ccb00\r\nCorrelation ID: 09254eb4-6128-4e18-a
bf6-70b5e9a68960\r\nTimestamp: 2019-05-09 12:39:29Z",
"error_codes":[700027],
"timestamp":"2019-05-09 12:39:29Z",
"trace_id":"0a77a624-684d-4145-9ce5-d19e1b6ccb00",
"correlation_id":"09254eb4-6128-4e18-abf6-70b5e9a68960"
}
.
我的问题是为什么 "x5t":如果从路径 AzureActiveDirectory-> AppRegistrations -> test-app-13- 上传 public 证书,"A0EFC8987ED4DB0732A42BEB63E8986A51CE3A68I" 不工作>设置->证书和机密->上传证书
以及为什么这两个地方customKeyIdentifier的值生成方式不同?
你引用的两个值相同,try running this hex2base64 on them.
一个是 base64 编码 oO/ImH7U2wcypCvrY+iYalHOOmg=
,另一个是十六进制表示 A0EFC8987ED4DB0732A42BEB63E8986A51CE3A68I
。
图服务似乎只支持base64编码后的值
我正在尝试使用 Certificate credentials for application authentication. 从 Microsoft Azure Active Directory 获取 JWT 令牌 我正在使用 customKeyIdentifier 值作为 x5t在生成 JWT 令牌时)
有两种创建应用程序的方法
1) App Registrations(Legacy)
2) App Registrations
从以上两个位置中的任何一个创建应用程序 test-app-13 后。 我从下面的两个路径上传了相同的 public 证书文件以获取 自定义密钥标识符.
1) AzureActiveDirectory->AppRegistrations(Legacy)->test-app-13->Settings->Keys->Upload public key
header = {
"alg": "RS256",
"typ": "JWT",
"x5t": "oO/ImH7U2wcypCvrY+iYalHOOmg="
};
当我使用 "x5t": "oO/ImH7U2wcypCvrY+iYalHOOmg=" 时,身份验证有效。
2) AzureActiveDirectory-> AppRegistrations -> test-app-13-> 证书和机密 -> 上传证书
header = {
"alg": "RS256",
"typ": "JWT",
"x5t": "A0EFC8987ED4DB0732A42BEB63E8986A51CE3A68"
};
但是当我使用 "x5t": "A0EFC8987ED4DB0732A42BEB63E8986A51CE3A68" 时,我不断收到错误消息
{
"error":"invalid_client",
"error_description":"AADSTS700027: Client assertion contains an invalid
signature. [Reason - The key was not found., Thumbprint of key used by
client:
'0341050BCF7CEC40F80C1D3BDF6038D81101EB713CF7CE80E75084DC0EBC', Please
visit 'https://developer.microsoft.com/en-us/graph/graph-explorer'
and query for
'https://graph.microsoft.com/beta/applications/2e452b20-df6d-4228-
83c6-5742b1a8f59c' to see configured keys]\r\nTrace ID: 0a77a624-
684d-4145-9ce5-d19e1b6ccb00\r\nCorrelation ID: 09254eb4-6128-4e18-a
bf6-70b5e9a68960\r\nTimestamp: 2019-05-09 12:39:29Z",
"error_codes":[700027],
"timestamp":"2019-05-09 12:39:29Z",
"trace_id":"0a77a624-684d-4145-9ce5-d19e1b6ccb00",
"correlation_id":"09254eb4-6128-4e18-abf6-70b5e9a68960"
}
.
我的问题是为什么 "x5t":如果从路径 AzureActiveDirectory-> AppRegistrations -> test-app-13- 上传 public 证书,"A0EFC8987ED4DB0732A42BEB63E8986A51CE3A68I" 不工作>设置->证书和机密->上传证书 以及为什么这两个地方customKeyIdentifier的值生成方式不同?
你引用的两个值相同,try running this hex2base64 on them.
一个是 base64 编码 oO/ImH7U2wcypCvrY+iYalHOOmg=
,另一个是十六进制表示 A0EFC8987ED4DB0732A42BEB63E8986A51CE3A68I
。
图服务似乎只支持base64编码后的值