18 SecondaryAuthManager::SecondaryAuthManager(
19 std::unique_ptr<fizz::SelfCert> cert) {
23 SecondaryAuthManager::~SecondaryAuthManager() {
26 std::pair<uint16_t, std::unique_ptr<folly::IOBuf>>
27 SecondaryAuthManager::createAuthRequest(
28 std::unique_ptr<folly::IOBuf> certRequestContext,
29 std::vector<fizz::Extension> extensions) {
31 uint16_t requestId = requestIdCounter_++;
37 contextQueue.append(
std::move(certRequestContext));
38 auto secureContext = contextQueue.move();
41 auto authRequestClone = authRequest->clone();
42 outstandingRequests_.insert(
43 std::make_pair(requestId,
std::move(authRequest)));
44 return std::make_pair(requestId,
std::move(authRequestClone));
47 std::pair<uint16_t, std::unique_ptr<folly::IOBuf>>
48 SecondaryAuthManager::getAuthenticator(
52 std::unique_ptr<folly::IOBuf> authRequest) {
54 std::unique_ptr<folly::IOBuf> authenticator;
62 requestCertMap_.insert(std::make_pair(requestId, certId));
63 return std::make_pair(certId,
std::move(authenticator));
66 bool SecondaryAuthManager::validateAuthenticator(
70 std::unique_ptr<folly::IOBuf> authenticator) {
73 auto authClone = authenticator->
clone();
74 auto authRequest = verifyContext(
std::move(authClone));
95 }
else if ((*certs).size() == 0) {
96 VLOG(4) <<
"Peer does not have appropriate certificate or does not want to " 97 "provide one, empty authenticator received";
99 receivedCerts_.insert(std::make_pair(certId,
std::move(*certs)));
105 SecondaryAuthManager::verifyContext(
106 std::unique_ptr<folly::IOBuf> authenticator) {
107 auto certRequestContext =
112 if (outstandingRequests_.find(requestId) == outstandingRequests_.end()) {
113 VLOG(4) <<
"No previous CERTIFICATE_REQUEST matches the the CERTIFICATE " 118 auto authRequest =
std::move(outstandingRequests_[requestId]);
123 if (requestCertMap_.find(requestId) == requestCertMap_.end()) {
134 if (receivedCerts_.find(certId) == receivedCerts_.end()) {
137 certChain =
std::move(receivedCerts_[certId]);
static folly::Optional< std::vector< CertificateEntry > > validateAuthenticator(const fizz::AsyncFizzBase &transport, Direction dir, Buf authenticatorRequest, Buf authenticator)
constexpr detail::Map< Move > move
std::unique_ptr< IOBuf > clone() const
static Buf getAuthenticator(const fizz::AsyncFizzBase &transport, Direction dir, const SelfCert &cert, Buf authenticatorRequest)
static Buf getAuthenticatorRequest(Buf certificateRequestContext, std::vector< fizz::Extension > extensions)
static Options cacheChainLength()
std::size_t computeChainDataLength() const
std::shared_ptr< PeerCert > getPeerCert(const CertAndKey &cert)
static Buf getAuthenticatorContext(Buf authenticator)