Added static Type method to some credential types (#37795)

* grpc_google_default_channel_credentials
* TlsServerCredentials
* grpc_alts(_server)_credentials
* UrlExternalAccountCredentials
* FileExternalAccountCredentials
* AwsExternalAccountCredentials

<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #37795

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37795 from AlienCookie:patch-1 34ffa5eca5
PiperOrigin-RevId: 681554756
pull/37770/merge
Kukki 4 months ago committed by Copybara-Service
parent d87165acf4
commit 7c7a979ab2
  1. 4
      src/core/lib/security/credentials/alts/alts_credentials.cc
  2. 8
      src/core/lib/security/credentials/alts/alts_credentials.h
  3. 2
      src/core/lib/security/credentials/external/aws_external_account_credentials.cc
  4. 4
      src/core/lib/security/credentials/external/aws_external_account_credentials.h
  5. 2
      src/core/lib/security/credentials/external/file_external_account_credentials.cc
  6. 4
      src/core/lib/security/credentials/external/file_external_account_credentials.h
  7. 2
      src/core/lib/security/credentials/external/url_external_account_credentials.cc
  8. 4
      src/core/lib/security/credentials/external/url_external_account_credentials.h
  9. 3
      src/core/lib/security/credentials/google_default/google_default_credentials.cc
  10. 4
      src/core/lib/security/credentials/google_default/google_default_credentials.h
  11. 2
      src/core/lib/security/credentials/tls/tls_credentials.cc
  12. 4
      src/core/lib/security/credentials/tls/tls_credentials.h

@ -54,7 +54,7 @@ grpc_alts_credentials::create_security_connector(
this->Ref(), std::move(call_creds), target_name);
}
grpc_core::UniqueTypeName grpc_alts_credentials::type() const {
grpc_core::UniqueTypeName grpc_alts_credentials::Type() {
static grpc_core::UniqueTypeName::Factory kFactory("Alts");
return kFactory.Create();
}
@ -80,7 +80,7 @@ grpc_alts_server_credentials::~grpc_alts_server_credentials() {
gpr_free(handshaker_service_url_);
}
grpc_core::UniqueTypeName grpc_alts_server_credentials::type() const {
grpc_core::UniqueTypeName grpc_alts_server_credentials::Type() {
static grpc_core::UniqueTypeName::Factory kFactory("Alts");
return kFactory.Create();
}

@ -43,7 +43,9 @@ class grpc_alts_credentials final : public grpc_channel_credentials {
grpc_core::RefCountedPtr<grpc_call_credentials> call_creds,
const char* target_name, grpc_core::ChannelArgs* args) override;
grpc_core::UniqueTypeName type() const override;
static grpc_core::UniqueTypeName Type();
grpc_core::UniqueTypeName type() const override { return Type(); }
const grpc_alts_credentials_options* options() const { return options_; }
grpc_alts_credentials_options* mutable_options() { return options_; }
@ -70,7 +72,9 @@ class grpc_alts_server_credentials final : public grpc_server_credentials {
grpc_core::RefCountedPtr<grpc_server_security_connector>
create_security_connector(const grpc_core::ChannelArgs& /* args */) override;
grpc_core::UniqueTypeName type() const override;
static grpc_core::UniqueTypeName Type();
grpc_core::UniqueTypeName type() const override { return Type(); }
const grpc_alts_credentials_options* options() const { return options_; }
grpc_alts_credentials_options* mutable_options() { return options_; }

@ -512,7 +512,7 @@ std::string AwsExternalAccountCredentials::debug_string() {
")");
}
UniqueTypeName AwsExternalAccountCredentials::type() const {
UniqueTypeName AwsExternalAccountCredentials::Type() {
static UniqueTypeName::Factory kFactory("AwsExternalAccountCredentials");
return kFactory.Create();
}

@ -51,7 +51,9 @@ class AwsExternalAccountCredentials final : public ExternalAccountCredentials {
std::string debug_string() override;
UniqueTypeName type() const override;
static UniqueTypeName Type();
UniqueTypeName type() const override { return Type(); }
private:
// A FetchBody impl that itself performs a sequence of FetchBody operations.

@ -157,7 +157,7 @@ std::string FileExternalAccountCredentials::debug_string() {
")");
}
UniqueTypeName FileExternalAccountCredentials::type() const {
UniqueTypeName FileExternalAccountCredentials::Type() {
static UniqueTypeName::Factory kFactory("FileExternalAccountCredentials");
return kFactory.Create();
}

@ -46,7 +46,9 @@ class FileExternalAccountCredentials final : public ExternalAccountCredentials {
std::string debug_string() override;
UniqueTypeName type() const override;
static UniqueTypeName Type();
UniqueTypeName type() const override { return Type(); }
private:
class FileFetchBody final : public FetchBody {

@ -137,7 +137,7 @@ std::string UrlExternalAccountCredentials::debug_string() {
")");
}
UniqueTypeName UrlExternalAccountCredentials::type() const {
UniqueTypeName UrlExternalAccountCredentials::Type() {
static UniqueTypeName::Factory kFactory("UrlExternalAccountCredentials");
return kFactory.Create();
}

@ -50,7 +50,9 @@ class UrlExternalAccountCredentials final : public ExternalAccountCredentials {
std::string debug_string() override;
UniqueTypeName type() const override;
static UniqueTypeName Type();
UniqueTypeName type() const override { return Type(); }
private:
OrphanablePtr<FetchBody> RetrieveSubjectToken(

@ -162,8 +162,7 @@ grpc_google_default_channel_credentials::update_arguments(
return args.SetIfUnset(GRPC_ARG_DNS_ENABLE_SRV_QUERIES, true);
}
grpc_core::UniqueTypeName grpc_google_default_channel_credentials::type()
const {
grpc_core::UniqueTypeName grpc_google_default_channel_credentials::Type() {
static grpc_core::UniqueTypeName::Factory kFactory("GoogleDefault");
return kFactory.Create();
}

@ -65,7 +65,9 @@ class grpc_google_default_channel_credentials
grpc_core::ChannelArgs update_arguments(grpc_core::ChannelArgs args) override;
grpc_core::UniqueTypeName type() const override;
static grpc_core::UniqueTypeName Type();
grpc_core::UniqueTypeName type() const override { return Type(); }
const grpc_channel_credentials* alts_creds() const {
return alts_creds_.get();

@ -145,7 +145,7 @@ TlsServerCredentials::create_security_connector(
CreateTlsServerSecurityConnector(this->Ref(), options_);
}
grpc_core::UniqueTypeName TlsServerCredentials::type() const {
grpc_core::UniqueTypeName TlsServerCredentials::Type() {
static grpc_core::UniqueTypeName::Factory kFactory("Tls");
return kFactory.Create();
}

@ -62,7 +62,9 @@ class TlsServerCredentials final : public grpc_server_credentials {
grpc_core::RefCountedPtr<grpc_server_security_connector>
create_security_connector(const grpc_core::ChannelArgs& /* args */) override;
grpc_core::UniqueTypeName type() const override;
static grpc_core::UniqueTypeName Type();
grpc_core::UniqueTypeName type() const override { return Type(); }
grpc_tls_credentials_options* options() const { return options_.get(); }

Loading…
Cancel
Save