| 59 | } |
| 60 | |
| 61 | int 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 |
nothing calls this directly
no test coverage detected