https://tools.ietf.org/html/rfc2617.
| 424 | |
| 425 | // https://tools.ietf.org/html/rfc2617. |
| 426 | class WWWAuthenticate |
| 427 | { |
| 428 | public: |
| 429 | static constexpr const char* NAME = "WWW-Authenticate"; |
| 430 | |
| 431 | WWWAuthenticate( |
| 432 | const std::string& authScheme, |
| 433 | const hashmap<std::string, std::string>& authParam) |
| 434 | : authScheme_(authScheme), |
| 435 | authParam_(authParam) {} |
| 436 | |
| 437 | static Try<WWWAuthenticate> create(const std::string& value); |
| 438 | |
| 439 | std::string authScheme(); |
| 440 | hashmap<std::string, std::string> authParam(); |
| 441 | |
| 442 | private: |
| 443 | // According to RFC, HTTP/1.1 server may return multiple challenges |
| 444 | // with a 401 (Authenticate) response. Each challenage is in the |
| 445 | // format of 'auth-scheme 1*SP 1#auth-param' and each challenage may |
| 446 | // use a different auth-scheme. |
| 447 | // https://tools.ietf.org/html/rfc2617#section-4.6 |
| 448 | // |
| 449 | // TODO(gilbert): We assume there is only one authenticate challenge. |
| 450 | // Multiple challenges should be supported as well. |
| 451 | std::string authScheme_; |
| 452 | hashmap<std::string, std::string> authParam_; |
| 453 | }; |
| 454 | |
| 455 | } // namespace header { |
| 456 |