如何知道用于连接到Vault的Vault令牌的有效性?

问题描述 投票:1回答:1

[当前,我正在使用公司令牌连接到公司保险库服务,并将其通过我的Spring Cloud Config Service中保留所有微服务属性的标头下方。

curl -X "GET" "http://localhost:8080/my-client-microservice/dev" -H "X-Config-Token: s.myvaulttoken"

其中http://localhost:8080是我的春季云配置服务,s.myvaulttoken是我的保管库令牌。这绝对正常。

我想知道此令牌的有效性。我已经阅读了文档,令牌可以分为两种类型:服务或批处理。我想知道此令牌是否可以无限使用(因为根令牌的有效性是无限的)。

enter image description here

由于客户端微服务需要保管库令牌,因此我想找出一种方法来了解令牌的有效性。你们可以帮我详细介绍一下吗?

我关注了此链接:https://learn.hashicorp.com/vault/getting-started/authentication

hashicorp-vault spring-cloud-vault-config spring-vault
1个回答
0
投票

Every non-root token has a time-to-live (TTL) associated with it.

例如:

  • 带有根令牌,ttl为0
    vault token lookup -format json  | jq .data.ttl
    0
    
  • [对于普通用户,ttl为非零

    VAULT_TOKEN=$(vault token create -policy default -field token) vault token 
    lookup -format json | jq .data.ttl
    2764799
    

也可以通过API进行此检查。

© www.soinside.com 2019 - 2024. All rights reserved.