azure - 上传公共(public)证书后,customKeyIdentifier 值无法用作 x5t

标签 azure certificate azure-active-directory azure-authentication

我尝试使用 Certificate credentials for application authentication. 从 Microsoft Azure Active Directory 获取 JWT token 我在生成 JWT token 时使用 customKeyIdentifier 值作为 x5t)

有两种创建应用程序的方法

1) App Registrations(Legacy)
2) App Registrations

enter image description here

从上述两个位置中的任何一个创建应用程序test-app-13后。 我从下面两个路径上传了相同的公共(public)证书文件来获取 自定义 key 标识符

1) AzureActiveDirectory-> AppRegistrations(Legacy) -> test-app-13->设置-> key ->上传公钥

header = {
"alg": "RS256",
"typ": "JWT",
"x5t": "oO/ImH7U2wcypCvrY+iYalHOOmg="
};

当我使用 "x5t": "oO/ImH7U2wcypCvrY+iYalHOOmg=" 时,身份验证有效。

enter image description here

2) AzureActiveDirectory-> AppRegistrations -> test-app-13-> 证书和 secret -> 上传证书

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"
  }

enter image description here

.

我的问题是为什么“x5t”:“A0EFC8987ED4DB0732A42BEB63E8986A51CE3A68I”如果从路径上传公共(public)证书则不起作用AzureActiveDirectory-> AppRegistrations -> test-app-13->设置->证书和 secret ->上传证书 为什么这两个地方生成的customKeyIdentifier的值不一样?

最佳答案

您引用的两个值是相同的,try running this hex2base64 on them.

一个是base64编码的oO/ImH7U2wcypCvrY+iYalHOOmg=,另一个是十六进制表示A0EFC8987ED4DB0732A42BEB63E8986A51CE3A68I

图形服务似乎仅支持base64编码时的值。

关于azure - 上传公共(public)证书后,customKeyIdentifier 值无法用作 x5t,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56072896/

相关文章:

azure - 更新物化 View azure adx?

azure - 如何在二头肌中做到这一点 : Create a Resource if another exists

powershell - Azure AD V2 PowerShell - 在输出中排除属性

azure - 如何在 Azure Function 中使用 TelemetryConfiguration 的依赖项注入(inject)

security - 如何修复 "this certificate cannot be verified up to a trusted certification authority"

java - Spring security - 启用 HTTPS - 客户端收到 403 未经授权

Django : How can we custom login_required decorator?

c# - 您建议编写哪些教学玩具程序来理解证书?

java - 绕过登录页面将用户直接发送到授权 URI

active-directory - Azure AD B2C 从电子邮件直接发送到身份提供商