proxygen
fizz::extensions::TokenBindingServerExtension Class Reference

#include <TokenBindingServerExtension.h>

Inheritance diagram for fizz::extensions::TokenBindingServerExtension:
fizz::ServerExtensions

Public Member Functions

 TokenBindingServerExtension (const std::shared_ptr< TokenBindingContext > &tokenBindingContext)
 
std::vector< ExtensiongetExtensions (const ClientHello &chlo) override
 
const auto & getNegotiatedKeyParam ()
 
- Public Member Functions inherited from fizz::ServerExtensions
virtual ~ServerExtensions ()=default
 

Private Member Functions

folly::Optional< TokenBindingProtocolVersionnegotiateVersion (const TokenBindingProtocolVersion &clientPref)
 

Private Attributes

std::shared_ptr< TokenBindingContexttokenBindingContext_
 
folly::Optional< TokenBindingKeyParametersnegotiatedKeyParam_
 

Detailed Description

Definition at line 19 of file TokenBindingServerExtension.h.

Constructor & Destructor Documentation

fizz::extensions::TokenBindingServerExtension::TokenBindingServerExtension ( const std::shared_ptr< TokenBindingContext > &  tokenBindingContext)
inlineexplicit

Definition at line 21 of file TokenBindingServerExtension.h.

23  : tokenBindingContext_(tokenBindingContext) {}
std::shared_ptr< TokenBindingContext > tokenBindingContext_

Member Function Documentation

std::vector<Extension> fizz::extensions::TokenBindingServerExtension::getExtensions ( const ClientHello chlo)
inlineoverridevirtual

Returns a list of extensions to be added to EncryptedExtensions, given a ClientHello.

Implements fizz::ServerExtensions.

Definition at line 25 of file TokenBindingServerExtension.h.

References fizz::encodeExtension(), fizz::ClientHello::extensions, fizz::extensions::TokenBindingParameters::key_parameters_list, folly::gen::move, fizz::server::negotiate(), negotiatedKeyParam_, negotiateVersion(), params, tokenBindingContext_, and fizz::extensions::TokenBindingParameters::version.

25  {
26  std::vector<Extension> serverExtensions;
27  auto params = getExtension<TokenBindingParameters>(chlo.extensions);
28  if (params) {
29  auto negotiatedVersion = negotiateVersion(params->version);
30  auto negotiatedKeyParam = server::negotiate(
31  tokenBindingContext_->getKeyParams(), params->key_parameters_list);
32  if (negotiatedKeyParam && negotiatedVersion) {
33  TokenBindingParameters negotiatedParams;
34  negotiatedParams.version = *negotiatedVersion;
35  negotiatedParams.key_parameters_list.push_back(*negotiatedKeyParam);
36  serverExtensions.push_back(encodeExtension(negotiatedParams));
37  negotiatedKeyParam_ = std::move(negotiatedKeyParam);
38  }
39  }
40  return serverExtensions;
41  }
static const std::string chlo
folly::Optional< T > negotiate(const std::vector< std::vector< T >> &serverPref, const std::vector< T > &clientPref)
Definition: Negotiator.h:22
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
folly::Optional< TokenBindingProtocolVersion > negotiateVersion(const TokenBindingProtocolVersion &clientPref)
std::shared_ptr< TokenBindingContext > tokenBindingContext_
constexpr Params params[]
folly::Optional< TokenBindingKeyParameters > negotiatedKeyParam_
Extension encodeExtension(const TokenBindingParameters &params)
Definition: Types.cpp:113
const auto& fizz::extensions::TokenBindingServerExtension::getNegotiatedKeyParam ( )
inline

Definition at line 42 of file TokenBindingServerExtension.h.

References negotiatedKeyParam_.

42  {
43  return negotiatedKeyParam_;
44  }
folly::Optional< TokenBindingKeyParameters > negotiatedKeyParam_
folly::Optional<TokenBindingProtocolVersion> fizz::extensions::TokenBindingServerExtension::negotiateVersion ( const TokenBindingProtocolVersion clientPref)
inlineprivate

For TokenBinding, the server can negotiate any version below the clients preferred version, inclusive.

Definition at line 54 of file TokenBindingServerExtension.h.

References folly::none.

Referenced by getExtensions().

55  {
56  for (const auto& pref : tokenBindingContext_->getSupportedVersions()) {
57  if (pref <= clientPref) {
58  return pref;
59  }
60  }
61  return folly::none;
62  }
std::shared_ptr< TokenBindingContext > tokenBindingContext_
constexpr None none
Definition: Optional.h:87

Member Data Documentation

folly::Optional<TokenBindingKeyParameters> fizz::extensions::TokenBindingServerExtension::negotiatedKeyParam_
private

Definition at line 48 of file TokenBindingServerExtension.h.

Referenced by getExtensions(), and getNegotiatedKeyParam().

std::shared_ptr<TokenBindingContext> fizz::extensions::TokenBindingServerExtension::tokenBindingContext_
private

Definition at line 47 of file TokenBindingServerExtension.h.

Referenced by getExtensions().


The documentation for this class was generated from the following file: