Merge pull request #25379 from bojeil-google/master

Move third party identity C++ api out of experimental namespace
pull/25396/head
Mark D. Roth 4 years ago committed by GitHub
commit df062598c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      include/grpcpp/security/credentials.h
  2. 4
      src/cpp/client/secure_credentials.cc
  3. 12
      test/cpp/client/credentials_test.cc

@ -277,6 +277,12 @@ class MetadataCredentialsPlugin {
std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
std::unique_ptr<MetadataCredentialsPlugin> plugin);
/// Builds External Account credentials.
/// json_string is the JSON string containing the credentials options.
/// scopes contains the scopes to be binded with the credentials.
std::shared_ptr<CallCredentials> ExternalAccountCredentials(
const grpc::string& json_string, const std::vector<grpc::string>& scopes);
namespace experimental {
/// Options for creating STS Oauth Token Exchange credentials following the IETF
@ -307,12 +313,6 @@ grpc::Status StsCredentialsOptionsFromEnv(StsCredentialsOptions* options);
std::shared_ptr<CallCredentials> StsCredentials(
const StsCredentialsOptions& options);
/// Builds External Account credentials.
/// json_string is the JSON string containing the credentials options.
/// scopes contains the scopes to be binded with the credentials.
std::shared_ptr<CallCredentials> ExternalAccountCredentials(
const grpc::string& json_string, const std::vector<grpc::string>& scopes);
std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
std::unique_ptr<MetadataCredentialsPlugin> plugin,
grpc_security_level min_security_level);

@ -109,8 +109,6 @@ std::shared_ptr<ChannelCredentials> GoogleDefaultCredentials() {
grpc_google_default_credentials_create(nullptr));
}
namespace experimental {
std::shared_ptr<CallCredentials> ExternalAccountCredentials(
const grpc::string& json_string, const std::vector<grpc::string>& scopes) {
grpc::GrpcLibraryCodegen init; // To call grpc_init().
@ -118,8 +116,6 @@ std::shared_ptr<CallCredentials> ExternalAccountCredentials(
json_string.c_str(), absl::StrJoin(scopes, ",").c_str()));
}
} // namespace experimental
// Builds SSL Credentials given SSL specific options
std::shared_ptr<ChannelCredentials> SslCredentials(
const SslCredentialsOptions& options) {

@ -110,8 +110,8 @@ TEST(CredentialsTest, ExternalAccountCredentials) {
"\"access_token\"}},\"quota_project_id\":\"quota_"
"project_id\",\"client_id\":\"client_id\",\"client_secret\":\"client_"
"secret\"}");
auto url_creds = grpc::experimental::ExternalAccountCredentials(
url_options_string, {"scope1", "scope2"});
auto url_creds = grpc::ExternalAccountCredentials(url_options_string,
{"scope1", "scope2"});
EXPECT_TRUE(url_creds != nullptr);
// file credentials
std::string file_options_string(
@ -123,8 +123,8 @@ TEST(CredentialsTest, ExternalAccountCredentials) {
"\"quota_project_id\":\"quota_"
"project_id\",\"client_id\":\"client_id\",\"client_secret\":\"client_"
"secret\"}");
auto file_creds = grpc::experimental::ExternalAccountCredentials(
file_options_string, {"scope1", "scope2"});
auto file_creds = grpc::ExternalAccountCredentials(file_options_string,
{"scope1", "scope2"});
EXPECT_TRUE(file_creds != nullptr);
// aws credentials
std::string aws_options_string(
@ -139,8 +139,8 @@ TEST(CredentialsTest, ExternalAccountCredentials) {
"\"quota_project_id\":\"quota_"
"project_id\",\"client_id\":\"client_id\",\"client_secret\":\"client_"
"secret\"}");
auto aws_creds = grpc::experimental::ExternalAccountCredentials(
aws_options_string, {"scope1", "scope2"});
auto aws_creds = grpc::ExternalAccountCredentials(aws_options_string,
{"scope1", "scope2"});
EXPECT_TRUE(aws_creds != nullptr);
}

Loading…
Cancel
Save