bes  Updated for version 3.20.8
AllowedHosts.h
1 // AllowedHosts.h
2 
3 // -*- mode: c++; c-basic-offset:4 -*-
4 
5 // This file is part of the OPeNDAP Back-End Server (BES)
6 // and creates a set of allowed hosts that may be
7 // accessed by the server as part of it's routine operation.
8 
9 // Copyright (c) 2018 OPeNDAP, Inc.
10 // Author: Nathan D. Potter <ndp@opendap.org>
11 //
12 // This library is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU Lesser General Public
14 // License as published by the Free Software Foundation; either
15 // version 2.1 of the License, or (at your option) any later version.
16 //
17 // This library is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 // Lesser General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public
23 // License along with this library; if not, write to the Free Software
24 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 //
26 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
27 
28 // Authors:
29 // ndp Nathan D. Potter <ndp@opendap.org>
30 
31 #ifndef I_AllowedHosts_H
32 #define I_AllowedHosts_H 1
33 
34 #include <string>
35 #include <vector>
36 
37 #define ALLOWED_HOSTS_BES_KEY "AllowedHosts"
38 
39 namespace bes {
40 
51 class AllowedHosts {
52 private:
53  static AllowedHosts *d_instance;
54 
55  std::vector<std::string> d_allowed_hosts;
56 
57 protected:
58  AllowedHosts();
59 
60 public:
61  virtual ~AllowedHosts() {}
62 
63  static AllowedHosts *theHosts();
64 
65  bool is_allowed(const std::string &candidate_url);
66 };
67 
68 } // namespace bes
69 
70 #endif // I_AllowedHosts_H
71 
Can a given URL be dereferenced given the BES's configuration?
Definition: AllowedHosts.h:51
bool is_allowed(const std::string &candidate_url)
Definition: AllowedHosts.cc:90
static AllowedHosts * theHosts()
Static accessor for the singleton.
Definition: AllowedHosts.cc:58