19 #ifndef GRPCPP_SECURITY_CREDENTIALS_H 20 #define GRPCPP_SECURITY_CREDENTIALS_H 36 class ChannelArguments;
38 class SecureChannelCredentials;
39 class CallCredentials;
40 class SecureCallCredentials;
42 class ChannelCredentials;
44 namespace experimental {
47 const std::shared_ptr<ChannelCredentials>& creds,
48 const ChannelArguments& args,
50 std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
51 interceptor_creators);
67 const std::shared_ptr<ChannelCredentials>& channel_creds,
68 const std::shared_ptr<CallCredentials>& call_creds);
70 virtual SecureChannelCredentials* AsSecureCredentials() = 0;
75 const std::shared_ptr<ChannelCredentials>& creds,
78 friend std::shared_ptr<Channel>
81 const std::shared_ptr<ChannelCredentials>& creds,
84 std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
85 interceptor_creators);
92 virtual std::shared_ptr<Channel> CreateChannelWithInterceptors(
95 std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>
96 interceptor_creators) {
111 virtual bool ApplyToCall(
grpc_call* call) = 0;
115 const std::shared_ptr<ChannelCredentials>& channel_creds,
116 const std::shared_ptr<CallCredentials>& call_creds);
119 const std::shared_ptr<CallCredentials>& creds1,
120 const std::shared_ptr<CallCredentials>& creds2);
122 virtual SecureCallCredentials* AsSecureCredentials() = 0;
179 long token_lifetime_seconds = kMaxAuthTokenLifetimeSecs);
216 const std::shared_ptr<ChannelCredentials>& channel_creds,
217 const std::shared_ptr<CallCredentials>& call_creds);
221 const std::shared_ptr<CallCredentials>& creds1,
222 const std::shared_ptr<CallCredentials>& creds2);
240 virtual const char*
GetType()
const {
return ""; }
247 virtual Status GetMetadata(
250 std::multimap<grpc::string, grpc::string>* metadata) = 0;
254 std::unique_ptr<MetadataCredentialsPlugin> plugin);
256 namespace experimental {
277 #endif // GRPCPP_SECURITY_CREDENTIALS_H struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:70
std::shared_ptr< ChannelCredentials > InsecureChannelCredentials()
Credentials for an unencrypted, unauthenticated channel.
std::shared_ptr< ChannelCredentials > CronetChannelCredentials(void *engine)
Credentials for a channel using Cronet.
std::string string
Definition: config.h:35
std::shared_ptr< CallCredentials > ServiceAccountJWTAccessCredentials(const grpc::string &json_key, long token_lifetime_seconds=kMaxAuthTokenLifetimeSecs)
Builds Service Account JWT Access credentials.
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< 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...
Options for channel creation.
Definition: channel_arguments.h:39
Class encapsulating the Authentication Information.
Definition: auth_context.h:65
std::shared_ptr< CallCredentials > GoogleComputeEngineCredentials()
Builds credentials for use when running in GCE.
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< 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< CallCredentials > GoogleRefreshTokenCredentials(const grpc::string &json_refresh_token)
Builds refresh token credentials.
Classes that require gRPC to be initialized should inherit from this class.
Definition: grpc_library.h:38
std::shared_ptr< Channel > CreateChannel(const grpc::string &target, const std::shared_ptr< ChannelCredentials > &creds)
Create a new Channel pointing to target.
std::shared_ptr< ChannelCredentials > AltsCredentials(const AltsCredentialsOptions &options)
Builds ALTS Credentials given ALTS specific options.
std::shared_ptr< ChannelCredentials > SslCredentials(const SslCredentialsOptions &options)
Builds SSL Credentials given SSL specific options.
Options used to build AltsCredentials.
Definition: credentials.h:259
grpc::string pem_root_certs
The buffer containing the PEM encoding of the server root certificates.
Definition: credentials.h:132
Options used to build SslCredentials.
Definition: credentials.h:126
grpc::string pem_cert_chain
The buffer containing the PEM encoding of the client's certificate chain.
Definition: credentials.h:141
std::vector< grpc::string > target_service_accounts
service accounts of target endpoint that will be acceptable by the client.
Definition: credentials.h:263
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
grpc::string pem_private_key
The buffer containing the PEM encoding of the client's private key.
Definition: credentials.h:136
This class is a non owning reference to a string.
Definition: string_ref.h:41
A channel credentials object encapsulates all the state needed by a client to authenticate with a ser...
Definition: credentials.h:60
Did it work? If it didn't, why?
Definition: status.h:31
std::shared_ptr< CallCredentials > GoogleIAMCredentials(const grpc::string &authorization_token, const grpc::string &authority_selector)
Builds IAM credentials.
A call credentials object encapsulates the state needed by a client to authenticate with a server for...
Definition: credentials.h:105
constexpr long kMaxAuthTokenLifetimeSecs
Constant for maximum auth token lifetime.
Definition: credentials.h:170
std::shared_ptr< ChannelCredentials > GoogleDefaultCredentials()
Builds credentials with reasonable defaults.
std::shared_ptr< CallCredentials > MetadataCredentialsFromPlugin(std::unique_ptr< MetadataCredentialsPlugin > plugin)
std::shared_ptr< CallCredentials > AccessTokenCredentials(const grpc::string &access_token)
Builds access token credentials.
std::shared_ptr< ChannelCredentials > LocalCredentials(grpc_local_connect_type type)
Builds Local Credentials.
grpc_local_connect_type
Type of local connections for which local channel/server credentials will be applied.
Definition: grpc_security_constants.h:112