MCPcopy Create free account
hub / github.com/apache/brpc / VerifyMyRequest

Function VerifyMyRequest

test/brpc_channel_unittest.cpp:115–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113};
114
115static bool VerifyMyRequest(const brpc::InputMessageBase* msg_base) {
116 const brpc::policy::MostCommonMessage* msg =
117 static_cast<const brpc::policy::MostCommonMessage*>(msg_base);
118 brpc::Socket* ptr = msg->socket();
119
120 brpc::policy::RpcMeta meta;
121 butil::IOBufAsZeroCopyInputStream wrapper(msg->meta);
122 EXPECT_TRUE(meta.ParseFromZeroCopyStream(&wrapper));
123
124 if (meta.has_authentication_data()) {
125 // Credential MUST only appear in the first packet
126 EXPECT_TRUE(NULL == ptr->auth_context());
127 EXPECT_EQ(meta.authentication_data(), MOCK_CREDENTIAL);
128 MyAuthenticator authenticator;
129 return authenticator.VerifyCredential(
130 "", butil::EndPoint(), ptr->mutable_auth_context()) == 0;
131 }
132 return true;
133}
134
135class CallAfterRpcObject {
136public:

Callers

nothing calls this directly

Calls 5

EndPointClass · 0.85
auth_contextMethod · 0.80
mutable_auth_contextMethod · 0.80
socketMethod · 0.45
VerifyCredentialMethod · 0.45

Tested by

no test coverage detected