Apache Mesos
authenticator_manager.hpp
Go to the documentation of this file.
1 // Licensed under the Apache License, Version 2.0 (the "License");
2 // you may not use this file except in compliance with the License.
3 // You may obtain a copy of the License at
4 //
5 // http://www.apache.org/licenses/LICENSE-2.0
6 //
7 // Unless required by applicable law or agreed to in writing, software
8 // distributed under the License is distributed on an "AS IS" BASIS,
9 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 // See the License for the specific language governing permissions and
11 // limitations under the License
12 
13 #ifndef __PROCESS_AUTHENTICATION_ROUTER_HPP__
14 #define __PROCESS_AUTHENTICATION_ROUTER_HPP__
15 
16 #include <string>
17 
19 #include <process/future.hpp>
20 #include <process/http.hpp>
21 #include <process/owned.hpp>
22 
23 #include <stout/nothing.hpp>
24 #include <stout/option.hpp>
25 
26 namespace process {
27 namespace http {
28 namespace authentication {
29 
30 class AuthenticatorManagerProcess;
31 
32 
33 // Manages the realm -> Authenticator mapping for HTTP
34 // authentication in libprocess. Endpoints may map to
35 // a realm. Each realm may have an authenticator set
36 // here, through which all requests to matching
37 // endpoints will be authenticated.
39 {
40 public:
43 
44  // Sets the authenticator for the realm; this will
45  // overwrite any previous authenticator for the realm.
47  const std::string& realm,
48  Owned<Authenticator> authenticator);
49 
50  // Unsets the authenticator for the realm.
51  Future<Nothing> unsetAuthenticator(const std::string& realm);
52 
53  // Authenticates the request, will return None if no
54  // authentication is required because there is no
55  // authenticator for the realm.
57  const Request& request,
58  const std::string& realm);
59 
60 private:
62 };
63 
64 } // namespace authentication {
65 } // namespace http {
66 } // namespace process {
67 
68 #endif // __PROCESS_REALM_MANAGER_HPP__
Definition: authenticator_manager.hpp:38
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...
Future< Nothing > unsetAuthenticator(const std::string &realm)
Definition: http.hpp:518
Future< Nothing > setAuthenticator(const std::string &realm, Owned< Authenticator > authenticator)
Future< Option< AuthenticationResult > > authenticate(const Request &request, const std::string &realm)
Definition: executor.hpp:47
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
Definition: owned.hpp:36