rpc_token_authentication.pxd 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. from libcpp cimport bool as c_bool
  2. from libcpp.memory cimport shared_ptr
  3. from libcpp.string cimport string
  4. from ray.includes.optional cimport optional
  5. cdef extern from "ray/rpc/authentication/authentication_mode.h" namespace "ray::rpc" nogil:
  6. cdef enum CAuthenticationMode "ray::rpc::AuthenticationMode":
  7. DISABLED "ray::rpc::AuthenticationMode::DISABLED"
  8. TOKEN "ray::rpc::AuthenticationMode::TOKEN"
  9. CAuthenticationMode GetAuthenticationMode()
  10. c_bool IsK8sTokenAuthEnabled()
  11. cdef extern from "ray/rpc/authentication/authentication_token.h" namespace "ray::rpc" nogil:
  12. cdef cppclass CAuthenticationToken "ray::rpc::AuthenticationToken":
  13. CAuthenticationToken()
  14. CAuthenticationToken(string value)
  15. c_bool empty()
  16. c_bool Equals(const CAuthenticationToken& other)
  17. string ToAuthorizationHeaderValue()
  18. string GetRawValue()
  19. @staticmethod
  20. CAuthenticationToken FromMetadata(string metadata_value)
  21. cdef extern from "ray/rpc/authentication/authentication_token_loader.h" namespace "ray::rpc" nogil:
  22. cdef cppclass CTokenLoadResult "ray::rpc::TokenLoadResult":
  23. optional[CAuthenticationToken] token
  24. string error_message
  25. c_bool hasError()
  26. cdef cppclass CAuthenticationTokenLoader "ray::rpc::AuthenticationTokenLoader":
  27. @staticmethod
  28. CAuthenticationTokenLoader& instance()
  29. void ResetCache()
  30. shared_ptr[const CAuthenticationToken] GetToken(c_bool ignore_auth_mode)
  31. CTokenLoadResult TryLoadToken(c_bool ignore_auth_mode)
  32. cdef extern from "ray/rpc/authentication/authentication_token_validator.h" namespace "ray::rpc" nogil:
  33. cdef cppclass CAuthenticationTokenValidator "ray::rpc::AuthenticationTokenValidator":
  34. @staticmethod
  35. CAuthenticationTokenValidator& instance()
  36. c_bool ValidateToken(const shared_ptr[const CAuthenticationToken]& expected_token, const string& provided_metadata)