13 #ifndef __PROCESS_AUTHENTICATOR_HPP__
14 #define __PROCESS_AUTHENTICATOR_HPP__
27 namespace authentication {
29 class BasicAuthenticatorProcess;
31 class JWTAuthenticatorProcess;
32 #endif // USE_SSL_SOCKET
60 return this->
value == that;
65 return !(*
this == that);
126 virtual std::string
scheme()
const = 0;
138 const std::string& realm,
146 std::string
scheme()
const override;
153 #ifdef USE_SSL_SOCKET
167 JWTAuthenticator(
const std::string& realm,
const std::string& secret);
169 ~JWTAuthenticator()
override;
174 std::string scheme()
const override;
179 #endif // USE_SSL_SOCKET
185 #endif // __PROCESS_AUTHENTICATOR_HPP__
virtual ~Authenticator()
Definition: authenticator.hpp:106
Future< Response > request(const Request &request, bool streamedResponse=false)
Asynchronously sends an HTTP request to the process and returns the HTTP response once the entire res...
Principal(const Option< std::string > &_value, const hashmap< std::string, std::string > &_claims)
Definition: authenticator.hpp:48
BasicAuthenticator(const std::string &realm, const hashmap< std::string, std::string > &credentials)
virtual Future< AuthenticationResult > authenticate(const Request &request)=0
Authenticates the given HTTP request.
bool operator==(const std::string &that) const
Definition: authenticator.hpp:58
Option< std::string > value
Definition: authenticator.hpp:68
Option< Principal > principal
Definition: authenticator.hpp:93
Represents the result of authenticating a request.
Definition: authenticator.hpp:91
Option< Forbidden > forbidden
Definition: authenticator.hpp:95
The Authenticator interface allows us to implement different authenticators based on the scheme (e...
Definition: authenticator.hpp:103
Implements the "Basic" authentication scheme using a fixed set of credentials.
Definition: authenticator.hpp:134
~BasicAuthenticator() override
Principal(const Option< std::string > &_value)
Definition: authenticator.hpp:45
bool operator!=(const std::string &that) const
Definition: authenticator.hpp:63
bool operator==(const Principal &that) const
Definition: authenticator.hpp:53
Future< AuthenticationResult > authenticate(const http::Request &request) override
Authenticates the given HTTP request.
Option< Unauthorized > unauthorized
Definition: authenticator.hpp:94
Result< Process > process(pid_t pid)
Definition: freebsd.hpp:30
virtual std::string scheme() const =0
Returns the name of the authentication scheme implemented.
Contains information associated with an authenticated principal.
Definition: authenticator.hpp:41
URI http(const std::string &host, const std::string &path="/", const Option< int > &port=None(), const Option< std::string > &query=None(), const Option< std::string > &fragment=None(), const Option< std::string > &user=None(), const Option< std::string > &password=None())
Creates an http URI with the given parameters.
Definition: http.hpp:35
std::string scheme() const override
Returns the name of the authentication scheme implemented.
hashmap< std::string, std::string > claims
Definition: authenticator.hpp:69
std::ostream & operator<<(std::ostream &stream, const Principal &principal)
Definition: future.hpp:57