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

Method VerifyCredential

src/brpc/policy/giano_authenticator.cpp:61–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61int GianoAuthenticator::VerifyCredential(
62 const std::string& auth_str,
63 const butil::EndPoint& client_addr,
64 AuthContext* out_ctx) const {
65 if (NULL == _verifier) {
66 LOG(FATAL) << "CredentialVerifier is NULL";
67 return -1;
68 }
69
70 baas::CredentialContext ctx;
71 int rc = _verifier->Verify(
72 auth_str, endpoint2str(client_addr).c_str(), &ctx);
73 if (rc != baas::sdk::BAAS_OK) {
74 LOG(WARNING) << "Giano fails to verify credentical, "
75 << baas::sdk::GetReturnCodeMessage(rc);
76 return -1;
77 }
78 if (out_ctx != NULL) {
79 out_ctx->set_user(ctx.user());
80 out_ctx->set_group(ctx.group());
81 out_ctx->set_roles(ctx.roles());
82 out_ctx->set_starter(ctx.starter());
83 out_ctx->set_is_service(ctx.IsService());
84 }
85 return 0;
86}
87
88} // namespace policy
89} // namespace brpc

Callers

nothing calls this directly

Calls 7

endpoint2strFunction · 0.85
set_userMethod · 0.80
set_groupMethod · 0.80
set_rolesMethod · 0.80
set_starterMethod · 0.80
set_is_serviceMethod · 0.80
c_strMethod · 0.45

Tested by

no test coverage detected