|
|
@ -136,15 +136,24 @@ struct grpc_security_context_extension { |
|
|
|
void (*destroy)(void*) = nullptr; |
|
|
|
void (*destroy)(void*) = nullptr; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace grpc_core { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SecurityContext { |
|
|
|
|
|
|
|
public: |
|
|
|
|
|
|
|
virtual ~SecurityContext() = default; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace grpc_core
|
|
|
|
|
|
|
|
|
|
|
|
// --- grpc_client_security_context ---
|
|
|
|
// --- grpc_client_security_context ---
|
|
|
|
|
|
|
|
|
|
|
|
// Internal client-side security context.
|
|
|
|
// Internal client-side security context.
|
|
|
|
|
|
|
|
|
|
|
|
struct grpc_client_security_context { |
|
|
|
struct grpc_client_security_context final : public grpc_core::SecurityContext { |
|
|
|
explicit grpc_client_security_context( |
|
|
|
explicit grpc_client_security_context( |
|
|
|
grpc_core::RefCountedPtr<grpc_call_credentials> creds) |
|
|
|
grpc_core::RefCountedPtr<grpc_call_credentials> creds) |
|
|
|
: creds(std::move(creds)) {} |
|
|
|
: creds(std::move(creds)) {} |
|
|
|
~grpc_client_security_context(); |
|
|
|
~grpc_client_security_context() override; |
|
|
|
|
|
|
|
|
|
|
|
grpc_core::RefCountedPtr<grpc_call_credentials> creds; |
|
|
|
grpc_core::RefCountedPtr<grpc_call_credentials> creds; |
|
|
|
grpc_core::RefCountedPtr<grpc_auth_context> auth_context; |
|
|
|
grpc_core::RefCountedPtr<grpc_auth_context> auth_context; |
|
|
@ -159,9 +168,9 @@ void grpc_client_security_context_destroy(void* ctx); |
|
|
|
|
|
|
|
|
|
|
|
// Internal server-side security context.
|
|
|
|
// Internal server-side security context.
|
|
|
|
|
|
|
|
|
|
|
|
struct grpc_server_security_context { |
|
|
|
struct grpc_server_security_context final : public grpc_core::SecurityContext { |
|
|
|
grpc_server_security_context() = default; |
|
|
|
grpc_server_security_context() = default; |
|
|
|
~grpc_server_security_context(); |
|
|
|
~grpc_server_security_context() override; |
|
|
|
|
|
|
|
|
|
|
|
grpc_core::RefCountedPtr<grpc_auth_context> auth_context; |
|
|
|
grpc_core::RefCountedPtr<grpc_auth_context> auth_context; |
|
|
|
grpc_security_context_extension extension; |
|
|
|
grpc_security_context_extension extension; |
|
|
@ -178,4 +187,20 @@ grpc_auth_context* grpc_auth_context_from_arg(const grpc_arg* arg); |
|
|
|
grpc_auth_context* grpc_find_auth_context_in_args( |
|
|
|
grpc_auth_context* grpc_find_auth_context_in_args( |
|
|
|
const grpc_channel_args* args); |
|
|
|
const grpc_channel_args* args); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace grpc_core { |
|
|
|
|
|
|
|
template <> |
|
|
|
|
|
|
|
struct ArenaContextType<SecurityContext> { |
|
|
|
|
|
|
|
static void Destroy(SecurityContext* p) { p->~SecurityContext(); } |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <> |
|
|
|
|
|
|
|
struct ContextSubclass<grpc_client_security_context> { |
|
|
|
|
|
|
|
using Base = SecurityContext; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
template <> |
|
|
|
|
|
|
|
struct ContextSubclass<grpc_server_security_context> { |
|
|
|
|
|
|
|
using Base = SecurityContext; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} // namespace grpc_core
|
|
|
|
|
|
|
|
|
|
|
|
#endif // GRPC_SRC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H
|
|
|
|
#endif // GRPC_SRC_CORE_LIB_SECURITY_CONTEXT_SECURITY_CONTEXT_H
|
|
|
|