1 //
2 //
3 // Copyright 2020 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 #ifndef GRPC_CORE_LIB_SECURITY_AUTHORIZATION_EVALUATE_ARGS_H
20 #define GRPC_CORE_LIB_SECURITY_AUTHORIZATION_EVALUATE_ARGS_H
21 
22 #include <grpc/support/port_platform.h>
23 
24 #include <map>
25 
26 #include "src/core/lib/iomgr/endpoint.h"
27 #include "src/core/lib/security/context/security_context.h"
28 #include "src/core/lib/transport/metadata_batch.h"
29 
30 namespace grpc_core {
31 
32 class EvaluateArgs {
33  public:
EvaluateArgs(grpc_metadata_batch * metadata,grpc_auth_context * auth_context,grpc_endpoint * endpoint)34   EvaluateArgs(grpc_metadata_batch* metadata, grpc_auth_context* auth_context,
35                grpc_endpoint* endpoint)
36       : metadata_(metadata), auth_context_(auth_context), endpoint_(endpoint) {}
37 
38   absl::string_view GetPath() const;
39   absl::string_view GetHost() const;
40   absl::string_view GetMethod() const;
41   std::multimap<absl::string_view, absl::string_view> GetHeaders() const;
42   absl::string_view GetLocalAddress() const;
43   int GetLocalPort() const;
44   absl::string_view GetPeerAddress() const;
45   int GetPeerPort() const;
46   absl::string_view GetSpiffeId() const;
47   absl::string_view GetCertServerName() const;
48 
49   // TODO(unknown): Add a getter function for source.principal
50 
51  private:
52   grpc_metadata_batch* metadata_;
53   grpc_auth_context* auth_context_;
54   grpc_endpoint* endpoint_;
55 };
56 
57 }  // namespace grpc_core
58 
59 #endif  // GRPC_CORE_LIB_SECURITY_AUTHORIZATION_EVALUATE_ARGS_H
60