codecamp

Spring Cloud Vault GCP-IAM身份验证

GCP AUTH后端允许Vault通过使用现有的GCP(谷歌云端平台)IAM和GCE凭证登录。

GCP IAM身份验证为服务帐户创建JSON Web令牌(JWT)形式的签名。通过调用GCP IAM的projects.serviceAccounts.signJwtAPI 获得服务帐户的JWT 呼叫者针对GCP IAM进行身份验证,从而证明其身份。此Vault后端将GCP视为受信任的第三方。

IAM凭证可以从运行时环境(特别是GOOGLE_APPLICATION_CREDENTIALS 环境变量),Google Compute元数据服务获得,也可以从外部以JSON或base64编码的形式提供。JSON是首选格式,因为它带有调用projects.serviceAccounts.signJwt所需的项目ID和服务帐户标识符。

示例102.20 bootstrap.yml具有必需的GCP-IAM身份验证属性

spring.cloud.vault:
    authentication: GCP_IAM
    gcp-iam:
        role: my-dev-role

示例102.21。具有所有GCP-IAM身份验证属性的bootstrap.yml

spring.cloud.vault:
    authentication: GCP_IAM
    gcp-iam:
        credentials:
            location: classpath:credentials.json
            encoded-key: e+KApn0=
        gcp-path: gcp
        jwt-validity: 15m
        project-id: my-project-id
        role: my-dev-role
        service-account-id: my-service@projectid.iam.gserviceaccount.com
  • role设置尝试进行登录的角色的名称。
  • credentials.location包含JSON格式的Google凭据的凭据资源的路径。
  • credentials.encoded-key JSON格式的OAuth2帐户私钥的base64编码内容。
  • gcp-path设置要使用的GCP安装架的路径
  • jwt-validity配置JWT令牌有效性。默认为15分钟。
  • project-id允许将项目ID覆盖为特定值。从获得的凭据中默认为项目ID。
  • service-account允许将服务帐户ID覆盖为特定值。默认为获取的凭证中的服务帐户。

GCP IAM身份验证需要Google Cloud Java SDK依赖项(com.google.apis:google-api-services-iamcom.google.auth:google-auth-library-oauth2-http),因为身份验证实现使用Google API进行凭据和JWT签名。

Google凭据需要OAuth 2令牌来维护令牌的生命周期。所有API都是同步的,因此GcpIamAuthentication不支持AuthenticationSteps,这是无功使用所必需的。

也可以看看:


Spring Cloud Vault GCP-GCE认证
Spring Cloud Vault Kubernetes身份验证
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

三、Spring Cloud Netflix

SpringCloud Hystrix超时和Ribbon客户

SpringCloud 重试失败的请求

五、Spring Cloud Stream

六、SpringCloud Binder实现

SpringCloud 重试RabbitMQ Binder

SpringCloud Dead-Letter队列处理

八、Spring Cloud Sleuth

SpringCloud 当前Span

十二、Spring Cloud for Cloud Foundry

十三、Spring Cloud Contract

Spring Cloud Contract验证程序设置

SrpingCloud Gradle项目

十五、Spring Cloud网关

Spring Cloud 配置路由谓词工厂和网关过滤工厂

Spring Cloud TLS / SSL

Spring Cloud网关配置

SpringCloud 故障排除

十八、Spring Cloud GCP

Spring Cloud GCP Spring资源

Spring Cloud Spring JDBC

Spring Cloud Redis的Cloud Memorystore

Spring Cloud 云身份识别代理(IAP)身份验证

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }