cpp/client/insecure_credentials.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 #include <memory>
19 #include <string>
20 #include <utility>
21 #include <vector>
22 
23 #include <grpc/grpc.h>
24 #include <grpc/grpc_security.h>
26 #include <grpcpp/channel.h>
30 #include <grpcpp/support/config.h>
31 
33 
34 namespace grpc {
35 
36 namespace {
37 class InsecureChannelCredentialsImpl final : public ChannelCredentials {
38  public:
39  std::shared_ptr<Channel> CreateChannelImpl(
40  const std::string& target, const ChannelArguments& args) override {
41  return CreateChannelWithInterceptors(
42  target, args,
43  std::vector<std::unique_ptr<
45  }
46 
47  std::shared_ptr<Channel> CreateChannelWithInterceptors(
48  const std::string& target, const ChannelArguments& args,
49  std::vector<std::unique_ptr<
51  interceptor_creators) override {
52  grpc_channel_args channel_args;
53  args.SetChannelArgs(&channel_args);
55  std::shared_ptr<Channel> channel = grpc::CreateChannelInternal(
56  "", grpc_channel_create(target.c_str(), creds, &channel_args),
57  std::move(interceptor_creators));
59  return channel;
60  }
61 
62  SecureChannelCredentials* AsSecureCredentials() override { return nullptr; }
63 
64  private:
65  bool IsInsecure() const override { return true; }
66 };
67 } // namespace
68 
69 std::shared_ptr<ChannelCredentials> InsecureChannelCredentials() {
70  return std::shared_ptr<ChannelCredentials>(
71  new InsecureChannelCredentialsImpl());
72 }
73 
74 } // namespace grpc
grpc::CreateChannelInternal
std::shared_ptr< Channel > CreateChannelInternal(const std::string &host, grpc_channel *c_channel, std::vector< std::unique_ptr< experimental::ClientInterceptorFactoryInterface >> interceptor_creators)
create_channel_internal.h
grpc
Definition: grpcpp/alarm.h:33
grpc::experimental::ClientInterceptorFactoryInterface
Definition: impl/codegen/client_interceptor.h:48
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc_security.h
grpc_channel_args
Definition: grpc_types.h:132
grpc_types.h
client_interceptor.h
channel
wrapped_grpc_channel * channel
Definition: src/php/ext/grpc/call.h:33
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
channel_arguments.h
grpc.h
grpc_insecure_credentials_create
GRPCAPI grpc_channel_credentials * grpc_insecure_credentials_create()
Definition: core/lib/security/credentials/insecure/insecure_credentials.cc:64
channel.h
config.h
grpc_channel_credentials_release
GRPCAPI void grpc_channel_credentials_release(grpc_channel_credentials *creds)
Definition: credentials.cc:36
grpc_channel_create
GRPCAPI grpc_channel * grpc_channel_create(const char *target, grpc_channel_credentials *creds, const grpc_channel_args *args)
Definition: chttp2_connector.cc:366
credentials.h
grpc.beta.implementations.ChannelCredentials
ChannelCredentials
Definition: implementations.py:33
grpc::InsecureChannelCredentials
std::shared_ptr< ChannelCredentials > InsecureChannelCredentials()
Credentials for an unencrypted, unauthenticated channel.
Definition: cpp/client/insecure_credentials.cc:69
setup.target
target
Definition: third_party/bloaty/third_party/protobuf/python/setup.py:179
grpc_channel_credentials
Definition: src/core/lib/security/credentials/credentials.h:96


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:20