blob: 3b1872d70b58102e1861134c5da9318194d71618 (
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 <util/system/compat.h>
#include <library/cpp/http/misc/httpcodes.h>
class httpDigestHandler {
protected:
const char* User_;
const char* Password_;
char* Nonce_;
int NonceCount_;
char* HeaderInstruction_;
void clear();
void generateCNonce(char* outCNonce);
void digestCalcHA1(const THttpAuthHeader& hd,
char* outSessionKey,
char* outCNonce);
void digestCalcResponse(const THttpAuthHeader& hd,
const char* method,
const char* path,
const char* nonceCount,
char* outResponse,
char* 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;
};
|