blob: e5ffa3c69ef7bd447de4430de72d350700f93691 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#pragma once
#include "httpheader.h"
#include <string>
#include <util/system/compat.h>
#include <library/cpp/http/misc/httpcodes.h>
class httpDigestHandler {
private:
const char* User_;
const char* Password_;
char* Nonce_;
int NonceCount_;
char* HeaderInstruction_;
void clear();
void digestCalcHA1(const THttpAuthHeader& hd,
char* outSessionKey,
const std::string& outCNonce);
void digestCalcResponse(const THttpAuthHeader& hd,
const char* method,
const char* path,
const char* nonceCount,
char* outResponse,
const std::string& outCNonce);
public:
httpDigestHandler();
~httpDigestHandler();
void setAuthorization(const char* user,
const char* password);
bool processHeader(const THttpAuthHeader* header,
const char* path,
const char* method,
const char* cnonce = nullptr);
bool empty() const {
return (!User_);
}
const char* getHeaderInstruction() const;
};
|