简体   繁体   English

尝试使用 cloudrun 实例上的 unix 套接字连接到 Google CloudSQL 时,如何获取 IAM 用户的用户名?

[英]How do I get the username for the IAM user when trying to connect to Google CloudSQL using a unix socket on a cloudrun instance?

I have the following code to get my username from a env var in a run instance using Java...我有以下代码使用 Java 从运行实例中的 env var 获取我的用户名...

    String dbUser = Optional.ofNullable(System.getenv("DB_USER")).orElseGet(() -> {
        EXIT.accept("You must Provide a DB Username");
        return null;
    });

My main question is, since I am using IAM auth, is there a way I can get this username without having to use an Env Variable.我的主要问题是,由于我使用的是 IAM 身份验证,有没有一种方法可以在不使用 Env 变量的情况下获取此用户名。 Kind of like how the password can be empty.有点像密码可以为空。

As explained in the documentation , the username must be provided, not the password.文档中所述,必须提供用户名,而不是密码。 The user access token act as validation of the user name account and grant the authorized users.用户访问令牌充当用户名帐户的验证并授予授权用户。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 IAM 用户对 Google Cloud Storage Bucket 进行日志记录和监控 - how to do Logging & Monitoring on Google Cloud Storage Buckets with IAM user 从 C# CloudRun 连接 CloudSQL MySQL public IP 时出错 - Error when connecting CloudSQL MySQL public IP from C# CloudRun 如何使用 Amplify Auth 获取 IAM 凭证? - How do you get IAM credentials using Amplify Auth? Google Cloud CloudSQL 实例无法使用 Terraform 提供程序创建,并出现错误“未找到每产品每项目服务帐户” - Google Cloud CloudSQL Instance Fails To Create using Terraform Provider With Error "Per-Product Per-Project Service Account is not found" 如何修复 CloudRun 错误“请求已中止,因为没有可用实例” - How to fix CloudRun error 'The request was aborted because there was no available instance' 如何在 cloudrun 中公开 2 个端口 - How to expose 2 ports in cloudrun 使用 VPC 和 peer.networking 时如何从 Google Cloud Run 连接到 MongoDB Atlas? - How do you connect to MongoDB Atlas from Google Cloud Run when using VPC and peer networking? 使用CloudRun和Google SQL,cloud run会自动使用连接池吗? - Using CloudRun and Google SQL, will cloud run automatically use connection pooling? 为什么在 firebase 使用 swift 创建用户时得到两个用户 ID? - why do i get two user ids when creating a user in firebase using swift? Google CloudSQL - 如何删除由 terraform 创建的超级用户权限 - Google CloudSQL - How to remove remove superuser permissions created by terraform
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM