GRPC C++  1.39.1
authorization_policy_provider.h
Go to the documentation of this file.
1 // Copyright 2021 gRPC authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GRPCPP_SECURITY_AUTHORIZATION_POLICY_PROVIDER_H
16 #define GRPCPP_SECURITY_AUTHORIZATION_POLICY_PROVIDER_H
17 
18 #include <grpc/status.h>
20 
21 #include <memory>
22 
23 // TODO(yihuazhang): remove the forward declaration here and include
24 // <grpc/grpc_security.h> directly once the insecure builds are cleaned up.
27 
28 namespace grpc {
29 namespace experimental {
30 
31 // Wrapper around C-core grpc_authorization_policy_provider. Internally, it
32 // handles creating and updating authorization engine objects, using SDK
33 // authorization policy.
35  public:
38 };
39 
40 // Implementation obtains authorization policy from static string. This provider
41 // will always return the same authorization engines.
44  public:
45  static std::shared_ptr<StaticDataAuthorizationPolicyProvider> Create(
46  const std::string& authz_policy, grpc::Status* status);
47 
48  // Use factory method "Create" to create an instance of
49  // StaticDataAuthorizationPolicyProvider.
52  : c_provider_(provider) {}
53 
55 
57  return c_provider_;
58  }
59 
60  private:
61  grpc_authorization_policy_provider* c_provider_ = nullptr;
62 };
63 
64 } // namespace experimental
65 } // namespace grpc
66 
67 #endif // GRPCPP_SECURITY_AUTHORIZATION_POLICY_PROVIDER_H
Did it work? If it didn't, why?
Definition: status.h:31
Definition: authorization_policy_provider.h:34
virtual grpc_authorization_policy_provider * c_provider()=0
Definition: authorization_policy_provider.h:43
static std::shared_ptr< StaticDataAuthorizationPolicyProvider > Create(const std::string &authz_policy, grpc::Status *status)
StaticDataAuthorizationPolicyProvider(grpc_authorization_policy_provider *provider)
Definition: authorization_policy_provider.h:50
grpc_authorization_policy_provider * c_provider() override
Definition: authorization_policy_provider.h:56
struct grpc_authorization_policy_provider grpc_authorization_policy_provider
EXPERIMENTAL - Subject to change.
Definition: grpc_security.h:1093
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33