MCPcopy Create free account
hub / github.com/apache/impala / JWTTokenAuth

Method JWTTokenAuth

be/src/util/webserver.cc:1156–1185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1154}
1155
1156bool Webserver::JWTTokenAuth(const std::string& jwt_token,
1157 struct sq_connection* connection, struct sq_request_info* request_info) {
1158 JWTHelper::UniqueJWTDecodedToken decoded_token;
1159 Status status = JWTHelper::Decode(jwt_token, decoded_token);
1160 if (!status.ok()) {
1161 LOG(ERROR) << "Error decoding JWT token in Authorization header, "
1162 << "Error: " << status;
1163 return false;
1164 }
1165 if (FLAGS_jwt_validate_signature) {
1166 status = ExecEnv::GetInstance()->GetJWTHelperInstance()->Verify(decoded_token.get());
1167 if (!status.ok()) {
1168 LOG(ERROR) << "Error verifying JWT token in Authorization header, "
1169 << "Error: " << status;
1170 return false;
1171 }
1172 }
1173
1174 DCHECK(!FLAGS_jwt_custom_claim_username.empty());
1175 string username;
1176 status = JWTHelper::GetCustomClaimUsername(
1177 decoded_token.get(), FLAGS_jwt_custom_claim_username, username);
1178 if (!status.ok()) {
1179 LOG(ERROR) << "Cannot retrieve username from JWT token in Authorization header, "
1180 << "Error: " << status;
1181 return false;
1182 }
1183 request_info->remote_user = strdup(username.c_str());
1184 return true;
1185}
1186
1187bool Webserver::OAuthTokenAuth(const std::string& oauth_token,
1188 struct sq_connection* connection, struct sq_request_info* request_info) {

Callers

nothing calls this directly

Calls 5

GetJWTHelperInstanceMethod · 0.80
getMethod · 0.65
okMethod · 0.45
VerifyMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected