| 2287 | |
| 2288 | |
| 2289 | Future<Response> Master::Http::state( |
| 2290 | const Request& request, |
| 2291 | const Option<Principal>& principal) const |
| 2292 | { |
| 2293 | // TODO(greggomann): Remove this check once the `Principal` type is used in |
| 2294 | // `ReservationInfo`, `DiskInfo`, and within the master's `principals` map. |
| 2295 | // See MESOS-7202. |
| 2296 | if (principal.isSome() && principal->value.isNone()) { |
| 2297 | return Forbidden( |
| 2298 | "The request's authenticated principal contains claims, but no value " |
| 2299 | "string. The master currently requires that principals have a value"); |
| 2300 | } |
| 2301 | |
| 2302 | // When current master is not the leader, redirect to the leading master. |
| 2303 | if (!master->elected()) { |
| 2304 | return redirect(request); |
| 2305 | } |
| 2306 | |
| 2307 | return ObjectApprovers::create( |
| 2308 | master->authorizer, |
| 2309 | principal, |
| 2310 | {VIEW_ROLE, VIEW_FRAMEWORK, VIEW_TASK, VIEW_EXECUTOR, VIEW_FLAGS}) |
| 2311 | .then(defer( |
| 2312 | master->self(), |
| 2313 | [this, request, principal](const Owned<ObjectApprovers>& approvers) { |
| 2314 | return deferBatchedRequest( |
| 2315 | &Master::ReadOnlyHandler::state, |
| 2316 | principal, |
| 2317 | ContentType::JSON, |
| 2318 | request.url.query, |
| 2319 | approvers); |
| 2320 | })); |
| 2321 | } |
| 2322 | |
| 2323 | |
| 2324 | Future<Response> Master::Http::deferBatchedRequest( |
no test coverage detected