Debian Codegraph @

src/core/lib/security/credentials/local/local_credentials.cc

raw
1 /*
2 *
3 * Copyright 2018 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
19 #include <grpc/support/port_platform.h>
20
21 #include "src/core/lib/security/credentials/local/local_credentials.h"
22
23 #include <utility>
24
25 #include "absl/strings/string_view.h"
26
27 #include <grpc/grpc.h>
28
29 #include "src/core/lib/security/security_connector/local/local_security_connector.h"
30
31 grpc_core::RefCountedPtr<grpc_channel_security_connector>
32 grpc_local_credentials::create_security_connector(
33 grpc_core::RefCountedPtr<grpc_call_credentials> request_metadata_creds,
34 const char* target_name, grpc_core::ChannelArgs* args) {
35 return grpc_local_channel_security_connector_create(
36 this->Ref(), std::move(request_metadata_creds), *args, target_name);
37 }
38
39 grpc_core::UniqueTypeName grpc_local_credentials::type() const {
40 static grpc_core::UniqueTypeName::Factory kFactory("Local");
41 return kFactory.Create();
42 }
43
44 grpc_core::RefCountedPtr<grpc_server_security_connector>
45 grpc_local_server_credentials::create_security_connector(
46 const grpc_core::ChannelArgs& /* args */) {
47 return grpc_local_server_security_connector_create(this->Ref());
48 }
49
50 grpc_core::UniqueTypeName grpc_local_server_credentials::type() const {
51 static grpc_core::UniqueTypeName::Factory kFactory("Local");
52 return kFactory.Create();
53 }
54
55 grpc_local_credentials::grpc_local_credentials(
56 grpc_local_connect_type connect_type)
57 : connect_type_(connect_type) {}
58
59 grpc_channel_credentials* grpc_local_credentials_create(
60 grpc_local_connect_type connect_type) {
61 return new grpc_local_credentials(connect_type);
62 }
63
64 grpc_local_server_credentials::grpc_local_server_credentials(
65 grpc_local_connect_type connect_type)
66 : connect_type_(connect_type) {}
67
68 grpc_server_credentials* grpc_local_server_credentials_create(
69 grpc_local_connect_type connect_type) {
70 return new grpc_local_server_credentials(connect_type);
71 }