Go to the documentation of this file.
19 #ifndef GRPCPP_SECURITY_CREDENTIALS_H
20 #define GRPCPP_SECURITY_CREDENTIALS_H
41 class CallCredentials;
42 class ChannelCredentials;
48 const grpc::string& target,
49 const std::shared_ptr<grpc::ChannelCredentials>& creds,
52 namespace experimental {
54 const grpc::string& target,
55 const std::shared_ptr<grpc::ChannelCredentials>& creds,
58 std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>>
59 interceptor_creators);
64 const std::shared_ptr<ChannelCredentials>& fallback_creds);
82 friend std::shared_ptr<grpc::Channel>
84 std::unique_ptr<grpc_event_engine::experimental::EventEngine::Endpoint>
86 const std::shared_ptr<ChannelCredentials>& creds,
88 #ifdef GPR_SUPPORT_CHANNELS_FROM_FD
89 friend std::shared_ptr<grpc::Channel> grpc::experimental::CreateChannelFromFd(
90 int fd,
const std::shared_ptr<ChannelCredentials>& creds,
92 #endif // GPR_SUPPORT_CHANNELS_FROM_FD
94 const grpc::string& target,
95 const std::shared_ptr<grpc::ChannelCredentials>& creds,
97 friend std::shared_ptr<grpc::Channel>
99 const grpc::string& target,
100 const std::shared_ptr<grpc::ChannelCredentials>& creds,
102 std::vector<std::unique_ptr<
104 interceptor_creators);
106 const std::shared_ptr<ChannelCredentials>& channel_creds,
107 const std::shared_ptr<CallCredentials>& call_creds);
110 virtual std::shared_ptr<Channel> CreateChannelImpl(
112 return CreateChannelWithInterceptors(target, args, {});
115 virtual std::shared_ptr<Channel> CreateChannelWithInterceptors(
116 const grpc::string& target,
const ChannelArguments& args,
117 std::vector<std::unique_ptr<
119 interceptor_creators);
142 const std::shared_ptr<ChannelCredentials>& channel_creds,
143 const std::shared_ptr<CallCredentials>& call_creds);
202 const grpc::string& json_key,
214 const grpc::string& json_refresh_token);
225 const grpc::string& access_token);
234 const grpc::string& authorization_token,
235 const grpc::string& authority_selector);
240 const std::shared_ptr<ChannelCredentials>& channel_creds,
241 const std::shared_ptr<CallCredentials>& call_creds);
245 const std::shared_ptr<CallCredentials>& creds1,
246 const std::shared_ptr<CallCredentials>& creds2);
261 virtual const char*
GetType()
const {
return ""; }
271 std::multimap<grpc::string, grpc::string>* metadata) = 0;
274 return "MetadataCredentialsPlugin did not provide a debug string";
279 std::unique_ptr<MetadataCredentialsPlugin> plugin);
285 const grpc::string& json_string,
const std::vector<grpc::string>& scopes);
287 namespace experimental {
318 std::unique_ptr<MetadataCredentialsPlugin> plugin,
344 #endif // GRPCPP_SECURITY_CREDENTIALS_H
std::shared_ptr< CallCredentials > StsCredentials(const StsCredentialsOptions &options)
std::shared_ptr< ChannelCredentials > TlsCredentials(const TlsChannelCredentialsOptions &options)
Builds TLS Credentials given TLS options.
std::shared_ptr< ChannelCredentials > XdsCredentials(const std::shared_ptr< ChannelCredentials > &fallback_creds)
Builds XDS Credentials.
This class is a non owning reference to a string.
Definition: string_ref.h:40
grpc::Status StsCredentialsOptionsFromJson(const std::string &json_string, StsCredentialsOptions *options)
grpc::string pem_cert_chain
The buffer containing the PEM encoding of the client's certificate chain.
Definition: credentials.h:166
Options for creating STS Oauth Token Exchange credentials following the IETF draft https://tools....
Definition: credentials.h:294
grpc::string pem_private_key
The buffer containing the PEM encoding of the client's private key.
Definition: credentials.h:161
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33
bool ApplyToCall(grpc_call *call)
Apply this instance's credentials to call.
friend std::shared_ptr< ChannelCredentials > CompositeChannelCredentials(const std::shared_ptr< ChannelCredentials > &channel_creds, const std::shared_ptr< CallCredentials > &call_creds)
Combines a channel credentials and a call credentials into a composite channel credentials.
std::shared_ptr< ChannelCredentials > GoogleDefaultCredentials()
Builds credentials with reasonable defaults.
grpc::string pem_root_certs
The buffer containing the PEM encoding of the server root certificates.
Definition: credentials.h:157
std::shared_ptr< ChannelCredentials > AltsCredentials(const AltsCredentialsOptions &options)
Builds ALTS Credentials given ALTS specific options.
grpc::Status StsCredentialsOptionsFromEnv(StsCredentialsOptions *options)
Creates STS credentials options from the $STS_CREDENTIALS environment variable.
friend std::shared_ptr< ChannelCredentials > CompositeChannelCredentials(const std::shared_ptr< ChannelCredentials > &channel_creds, const std::shared_ptr< CallCredentials > &call_creds)
Combines a channel credentials and a call credentials into a composite channel credentials.
Options used to build SslCredentials.
Definition: credentials.h:151
grpc::string DebugString()
std::shared_ptr< ChannelCredentials > SslCredentials(const SslCredentialsOptions &options)
Builds SSL Credentials given SSL specific options.
std::shared_ptr< CallCredentials > MetadataCredentialsFromPlugin(std::unique_ptr< MetadataCredentialsPlugin > plugin, grpc_security_level min_security_level)
grpc::string scope
Definition: credentials.h:298
std::string GetOauth2AccessToken()
friend class XdsChannelCredentialsImpl
Definition: credentials.h:108
grpc::string subject_token_path
Definition: credentials.h:300
~CallCredentials() override
Options for channel creation.
Definition: channel_arguments.h:39
grpc::string token_exchange_service_uri
Definition: credentials.h:295
std::shared_ptr< CallCredentials > ServiceAccountJWTAccessCredentials(const grpc::string &json_key, long token_lifetime_seconds=kMaxAuthTokenLifetimeSecs)
Builds Service Account JWT Access credentials.
Did it work? If it didn't, why?
Definition: status.h:34
Options used to build AltsCredentials.
Definition: credentials.h:322
friend class CompositeCallCredentialsImpl
Definition: credentials.h:144
A call credentials object encapsulates the state needed by a client to authenticate with a server for...
Definition: credentials.h:128
grpc::string subject_token_type
Definition: credentials.h:301
grpc_channel_credentials * c_creds()
Definition: credentials.h:79
struct grpc_channel_credentials grpc_channel_credentials
— grpc_channel_credentials object.
Definition: grpc.h:286
Definition: tls_credentials_options.h:154
~ChannelCredentials() override
std::shared_ptr< CallCredentials > MetadataCredentialsFromPlugin(std::unique_ptr< MetadataCredentialsPlugin > plugin)
grpc::string audience
Definition: credentials.h:297
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:68
struct grpc_call_credentials grpc_call_credentials
— grpc_call_credentials object —
Definition: credentials.h:37
ChannelCredentials(grpc_channel_credentials *creds)
grpc::string resource
Definition: credentials.h:296
Class encapsulating the Authentication Information.
Definition: auth_context.h:70
std::shared_ptr< ChannelCredentials > LocalCredentials(grpc_local_connect_type type)
Builds Local Credentials.
Classes that require gRPC to be initialized should inherit from this class.
Definition: grpc_library.h:32
std::shared_ptr< CallCredentials > ExternalAccountCredentials(const grpc::string &json_string, const std::vector< grpc::string > &scopes)
Builds External Account credentials.
std::shared_ptr< CallCredentials > GoogleComputeEngineCredentials()
Builds credentials for use when running in GCE.
grpc::string actor_token_type
Definition: credentials.h:303
std::vector< grpc::string > target_service_accounts
service accounts of target endpoint that will be acceptable by the client.
Definition: credentials.h:326
grpc_security_level
Definition: grpc_security_constants.h:131
std::shared_ptr< ChannelCredentials > InsecureChannelCredentials()
Credentials for an unencrypted, unauthenticated channel.
std::shared_ptr< CallCredentials > GoogleRefreshTokenCredentials(const grpc::string &json_refresh_token)
Builds refresh token credentials.
grpc::string requested_token_type
Definition: credentials.h:299
Definition: client_interceptor.h:48
std::shared_ptr< Channel > CreateCustomChannelWithInterceptors(const grpc::string &target, const std::shared_ptr< ChannelCredentials > &creds, const ChannelArguments &args, std::vector< std::unique_ptr< experimental::ClientInterceptorFactoryInterface >> interceptor_creators)
Create a new custom Channel pointing to target with interceptors being invoked per call.
A channel credentials object encapsulates all the state needed by a client to authenticate with a ser...
Definition: credentials.h:72
friend std::shared_ptr< grpc::Channel > CreateCustomChannel(const grpc::string &target, const std::shared_ptr< grpc::ChannelCredentials > &creds, const grpc::ChannelArguments &args)
std::shared_ptr< Channel > CreateCustomChannel(const grpc::string &target, const std::shared_ptr< ChannelCredentials > &creds, const ChannelArguments &args)
Create a new custom Channel pointing to target.
std::shared_ptr< ChannelCredentials > CompositeChannelCredentials(const std::shared_ptr< ChannelCredentials > &channel_creds, const std::shared_ptr< CallCredentials > &call_creds)
Combines a channel credentials and a call credentials into a composite channel credentials.
std::shared_ptr< CallCredentials > CompositeCallCredentials(const std::shared_ptr< CallCredentials > &creds1, const std::shared_ptr< CallCredentials > &creds2)
Combines two call credentials objects into a composite call credentials.
std::shared_ptr< grpc::Channel > CreateChannelFromEndpoint(std::unique_ptr< grpc_event_engine::experimental::EventEngine::Endpoint > endpoint, const std::shared_ptr< ChannelCredentials > &creds, const ChannelArguments &args)
Creates a new Channel from an EventEngine endpoint.
constexpr long kMaxAuthTokenLifetimeSecs
Definition: credentials.h:194
std::shared_ptr< CallCredentials > AccessTokenCredentials(const grpc::string &access_token)
Builds access token credentials.
grpc::string actor_token_path
Definition: credentials.h:302
grpc_local_connect_type
Type of local connections for which local channel/server credentials will be applied.
Definition: grpc_security_constants.h:143
std::shared_ptr< CallCredentials > GoogleIAMCredentials(const grpc::string &authorization_token, const grpc::string &authority_selector)
Builds IAM credentials.
CallCredentials(grpc_call_credentials *creds)