我如何或在哪里可以访问我的保险库OIDC日志和JWT声称元数据

发布于 2025-02-11 21:00:19 字数 1015 浏览 2 评论 0 原文

我已经设置了Hashicorp Vault(Enterprise Edition)的本地实例,以测试使用OIDC的Vault和Azure AD单登录的实现。我正在使用Terraform在Visual Studio代码中配置和配置我的OIDC组件,但遇到了与我的令牌索赔有关的错误(请参见下文)。

我如何或在哪里可以访问我的OIDC JWT声称元数据以验证其一些条目?我什至已经在我的 vault_jwt_auth_backend_role_role 配置中设置了 verbose_oidc_logging = true true ,但无法弄清楚我可以在哪里访问日志。

以下是Vault_jwt_auth_backend_role配置的完整片段。

resource "vault_jwt_auth_backend_role" "azure" {
  role_name             = var.azure_role_name 
  backend               = vault_jwt_auth_backend.root.path
  user_claim            = "email"
  groups_claim          = "groups" 
  
  bound_claims          = { "groups": "VaultAdmins" }
  
  role_type             = "oidc"
  oidc_scopes           = var.oidc_scopes 
  allowed_redirect_uris = var.allowed_redirect_uris
  verbose_oidc_logging  = "true" 

}

I have set up a local instance of HashiCorp Vault (Enterprise edition) to test an implementation of Vault and Azure AD Single Sign-On with OIDC. I am using Terraform to provision and configure my OIDC components in Visual Studio Code, but have run into an error (see below) relating to my token claim.

enter image description here

How or where can I access my oidc jwt claim metadata to verify some of its entries? I have even set the verbose_oidc_logging = true in my vault_jwt_auth_backend_role configuration but can't figure out where I can access the log.

Below is the full snippet of vault_jwt_auth_backend_role configuration.

resource "vault_jwt_auth_backend_role" "azure" {
  role_name             = var.azure_role_name 
  backend               = vault_jwt_auth_backend.root.path
  user_claim            = "email"
  groups_claim          = "groups" 
  
  bound_claims          = { "groups": "VaultAdmins" }
  
  role_type             = "oidc"
  oidc_scopes           = var.oidc_scopes 
  allowed_redirect_uris = var.allowed_redirect_uris
  verbose_oidc_logging  = "true" 

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撩动你心 2025-02-18 21:00:19

您如何访问令牌取决于应用程序正在使用的流程。

如果是隐式流程,您应该能够在登录过程中看到HTTP请求的有效载荷中的令牌。

如果是授权代码流(可能),则可以使用Postman来形成请求,并且您需要从应用程序的Azure Ad App注册中的一些值。

参数 描述
<代码> tenant_id azure ad tenant id
client_id azure ad Application(client)id
client_secret client client tecret for App
redirect_url 重定向URL发送给令牌的
scopes API权限该应用程序请求

获取授权代码

使用上述信息以登录到您的应用程序的链接,该链接应编码URL。

https://login.microsoftonline.com/{tenant_Id}/oauth2/v2.0/authorize?client_id={client_id}&redirect_uri={redirect_url}&response_type=code&response_mode=query&scope={scopes}&state=12345

示例

https://login.microsoftonline.com/abcde123-a123-1a23-b9a9-123a456bcd7d/oauth2/v2.0/authorize?response_type=code&redirect_uri=https%3A%2F%2Fapplication.azurewebsites.net%2F.auth%2Flogin%2Faad%2Fcallback&client_id=a1bcde23-a12b-1234-1a2b-1a23456b78cd&scope=openid%20profile%20email&response_mode=query&state=12345

打开一个带有开发人员工具打开的浏览器窗口,并使用链接登录到您的应用程序。 Azure AD成功身份验证您之后,您应该在有效负载中查看带有代码的请求。这是将用于交换令牌的授权代码。复制此值。

进行邮递员调用

方法
发布

url
https://login.microsoftonline.com/ {tenant_id}/oauth2/v2.0/token

标题

键值 content
-type application/x-www-form-urlcorded

body

键值 code
client_id client_id
client_secret client_secret
代码 >代码>代码> code
grant_type 授权
_Coderedirect_url redirect_url </
scope > scope scopes

结果

中查看访问令牌和ID令牌

您可以在请求正文 src =“ https://i.sstatic.net/t48xm.png” alt =“在此处输入图像说明”>

How you access the tokens will depend on which flow the app is using.

If it's an implicit flow, you should be able to see the tokens in the payload of the HTTP request during sign-on.

If it's an authorization code flow (likely), you can use Postman to form a request, and you'll need a few values from the Azure AD app registration for your app.

Parameter Description
tenant_Id Azure AD tenant ID
client_Id Azure AD application (client) ID
client_secret Client secret created for your app
redirect_url The redirect URL where the token is being sent
scopes The API permissions the app is requesting

Obtain authorization code

Use the above info to form a link to login to your application, the link should be URL encoded.

https://login.microsoftonline.com/{tenant_Id}/oauth2/v2.0/authorize?client_id={client_id}&redirect_uri={redirect_url}&response_type=code&response_mode=query&scope={scopes}&state=12345

Example

https://login.microsoftonline.com/abcde123-a123-1a23-b9a9-123a456bcd7d/oauth2/v2.0/authorize?response_type=code&redirect_uri=https%3A%2F%2Fapplication.azurewebsites.net%2F.auth%2Flogin%2Faad%2Fcallback&client_id=a1bcde23-a12b-1234-1a2b-1a23456b78cd&scope=openid%20profile%20email&response_mode=query&state=12345

Open a browser window with the developer tools open, and login to your app using the link. After Azure AD successfully authenticates you, you should see a request with a code in the payload. This is the authorization code that will be used to exchange for your tokens. Copy this value.

enter image description here

Make a Postman call

Method
POST

URL
https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token

Headers

Key Value
Content-Type application/x-www-form-urlencoded

Body

Key Value
client_id client_id
client_secret client_secret
code code
grant_type authorization_code
redirect_url redirect_url
scope scopes

Result

You can see the access token and the ID token in the request body

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文