/* * * Copyright 2015 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef GRPCPP_SECURITY_CREDENTIALS_H #define GRPCPP_SECURITY_CREDENTIALS_H #include namespace grpc { typedef ::grpc_impl::ChannelCredentials ChannelCredentials; typedef ::grpc_impl::CallCredentials CallCredentials; typedef ::grpc_impl::SslCredentialsOptions SslCredentialsOptions; typedef ::grpc_impl::SecureCallCredentials SecureCallCredentials; typedef ::grpc_impl::SecureChannelCredentials SecureChannelCredentials; typedef ::grpc_impl::MetadataCredentialsPlugin MetadataCredentialsPlugin; static inline std::shared_ptr GoogleDefaultCredentials() { return ::grpc_impl::GoogleDefaultCredentials(); } static inline std::shared_ptr SslCredentials( const SslCredentialsOptions& options) { return ::grpc_impl::SslCredentials(options); } static inline std::shared_ptr GoogleComputeEngineCredentials() { return ::grpc_impl::GoogleComputeEngineCredentials(); } /// Constant for maximum auth token lifetime. constexpr long kMaxAuthTokenLifetimeSecs = ::grpc_impl::kMaxAuthTokenLifetimeSecs; static inline std::shared_ptr ServiceAccountJWTAccessCredentials( const grpc::string& json_key, long token_lifetime_seconds = grpc::kMaxAuthTokenLifetimeSecs) { return ::grpc_impl::ServiceAccountJWTAccessCredentials( json_key, token_lifetime_seconds); } static inline std::shared_ptr GoogleRefreshTokenCredentials(const grpc::string& json_refresh_token) { return ::grpc_impl::GoogleRefreshTokenCredentials(json_refresh_token); } static inline std::shared_ptr AccessTokenCredentials(const grpc::string& access_token) { return ::grpc_impl::AccessTokenCredentials(access_token); } static inline std::shared_ptr GoogleIAMCredentials( const grpc::string& authorization_token, const grpc::string& authority_selector) { return ::grpc_impl::GoogleIAMCredentials(authorization_token, authority_selector); } static inline std::shared_ptr CompositeChannelCredentials( const std::shared_ptr& channel_creds, const std::shared_ptr& call_creds) { return ::grpc_impl::CompositeChannelCredentials(channel_creds, call_creds); } static inline std::shared_ptr CompositeCallCredentials(const std::shared_ptr& creds1, const std::shared_ptr& creds2) { return ::grpc_impl::CompositeCallCredentials(creds1, creds2); } static inline std::shared_ptr InsecureChannelCredentials() { return ::grpc_impl::InsecureChannelCredentials(); } static inline std::shared_ptr CronetChannelCredentials(void* engine) { return ::grpc_impl::CronetChannelCredentials(engine); } typedef ::grpc_impl::MetadataCredentialsPlugin MetadataCredentialsPlugin; static inline std::shared_ptr MetadataCredentialsFromPlugin( std::unique_ptr plugin) { return ::grpc_impl::MetadataCredentialsFromPlugin(std::move(plugin)); } namespace experimental { typedef ::grpc_impl::experimental::StsCredentialsOptions StsCredentialsOptions; static inline grpc::Status StsCredentialsOptionsFromJson( const grpc::string& json_string, StsCredentialsOptions* options) { return ::grpc_impl::experimental::StsCredentialsOptionsFromJson(json_string, options); } static inline grpc::Status StsCredentialsOptionsFromEnv( StsCredentialsOptions* options) { return grpc_impl::experimental::StsCredentialsOptionsFromEnv(options); } static inline std::shared_ptr StsCredentials( const StsCredentialsOptions& options) { return grpc_impl::experimental::StsCredentials(options); } typedef ::grpc_impl::experimental::AltsCredentialsOptions AltsCredentialsOptions; static inline std::shared_ptr AltsCredentials( const AltsCredentialsOptions& options) { return ::grpc_impl::experimental::AltsCredentials(options); } static inline std::shared_ptr LocalCredentials( grpc_local_connect_type type) { return ::grpc_impl::experimental::LocalCredentials(type); } } // namespace experimental } // namespace grpc #endif // GRPCPP_SECURITY_CREDENTIALS_H