proxygen
FizzConfigUtil.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
20 #include <fizz/util/FizzUtil.h>
21 
23 
24 namespace wangle {
25 
27  public:
28  static std::shared_ptr<fizz::server::FizzServerContext> createFizzContext(
30  std::unique_ptr<fizz::server::CertManager> certMgr = nullptr);
31 
32  // Creates a TicketCipher with given params
33  template <class TicketCipher>
34  static std::unique_ptr<TicketCipher> createTicketCipher(
35  const std::vector<std::string>& oldSecrets,
36  const std::vector<std::string>& currentSecrets,
37  const std::vector<std::string>& newSecrets,
38  std::chrono::seconds validity,
39  folly::Optional<std::string> pskContext) {
40  if (currentSecrets.empty()) {
41  return fizz::FizzUtil::createTicketCipher<TicketCipher>(
42  oldSecrets, "", newSecrets, validity, std::move(pskContext));
43  } else {
44  return fizz::FizzUtil::createTicketCipher<TicketCipher>(
45  oldSecrets,
46  currentSecrets.at(0),
47  newSecrets,
48  validity,
49  std::move(pskContext));
50  }
51  }
52 };
53 
54 } // namespace wangle
static std::unique_ptr< TicketCipher > createTicketCipher(const std::vector< std::string > &oldSecrets, const std::vector< std::string > &currentSecrets, const std::vector< std::string > &newSecrets, std::chrono::seconds validity, folly::Optional< std::string > pskContext)
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
static std::shared_ptr< fizz::server::FizzServerContext > createFizzContext(const wangle::ServerSocketConfig &config, std::unique_ptr< fizz::server::CertManager > certMgr=nullptr)
AHArrayT::Config config