secure_auth_context.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #ifndef GRPC_INTERNAL_CPP_COMMON_SECURE_AUTH_CONTEXT_H
  19. #define GRPC_INTERNAL_CPP_COMMON_SECURE_AUTH_CONTEXT_H
  20. #include <grpc++/security/auth_context.h>
  21. struct grpc_auth_context;
  22. namespace grpc {
  23. class SecureAuthContext final : public AuthContext {
  24. public:
  25. SecureAuthContext(grpc_auth_context* ctx, bool take_ownership);
  26. ~SecureAuthContext() override;
  27. bool IsPeerAuthenticated() const override;
  28. std::vector<grpc::string_ref> GetPeerIdentity() const override;
  29. grpc::string GetPeerIdentityPropertyName() const override;
  30. std::vector<grpc::string_ref> FindPropertyValues(
  31. const grpc::string& name) const override;
  32. AuthPropertyIterator begin() const override;
  33. AuthPropertyIterator end() const override;
  34. void AddProperty(const grpc::string& key,
  35. const grpc::string_ref& value) override;
  36. virtual bool SetPeerIdentityPropertyName(const grpc::string& name) override;
  37. private:
  38. grpc_auth_context* ctx_;
  39. bool take_ownership_;
  40. };
  41. } // namespace grpc
  42. #endif // GRPC_INTERNAL_CPP_COMMON_SECURE_AUTH_CONTEXT_H