aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/grpc/include/grpcpp/security/alts_context.h
blob: cc5a9dcad8d0b1c658a2bc4ca035d97a264d52c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
//
// Copyright 2019 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_ALTS_CONTEXT_H
#define GRPCPP_SECURITY_ALTS_CONTEXT_H

#include <map>
#include <memory>

#include <grpc/grpc_security_constants.h>
#include <grpcpp/security/auth_context.h>

struct grpc_gcp_AltsContext;

namespace grpc {
namespace experimental {

// AltsContext is a wrapper class for grpc_gcp_AltsContext.
class AltsContext {
 public:
  struct RpcProtocolVersions {
    struct Version {
      int major_version;
      int minor_version;
    };
    Version max_rpc_version;
    Version min_rpc_version;
  };
  explicit AltsContext(const grpc_gcp_AltsContext* ctx);
  AltsContext& operator=(const AltsContext&) = default;
  AltsContext(const AltsContext&) = default;

  TString application_protocol() const;
  TString record_protocol() const;
  TString peer_service_account() const;
  TString local_service_account() const;
  grpc_security_level security_level() const;
  RpcProtocolVersions peer_rpc_versions() const;
  const std::map<TString, TString>& peer_attributes() const;

 private:
  TString application_protocol_;
  TString record_protocol_;
  TString peer_service_account_;
  TString local_service_account_;
  grpc_security_level security_level_ = GRPC_SECURITY_NONE;
  RpcProtocolVersions peer_rpc_versions_ = {{0, 0}, {0, 0}};
  std::map<TString, TString> peer_attributes_map_;
};

}  // namespace experimental
}  // namespace grpc

#endif  // GRPCPP_SECURITY_ALTS_CONTEXT_H