Skip to content

Commit

Permalink
Merge pull request #354 from mmd-osm/patch/oauth10a_removal
Browse files Browse the repository at this point in the history
OAuth 1.0a removal
  • Loading branch information
mmd-osm committed Apr 16, 2024
2 parents 24709f1 + 888e35b commit 6dd16a5
Show file tree
Hide file tree
Showing 46 changed files with 260 additions and 2,423 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ https://github.com/zerebubuth/openstreetmap-cgimap/pull/213 has additional confi
## Database Permissions

The read only apidb backend requires permissions to SELECT on the Postgres server.
OAuth and update database connections require additional permissions to INSERT/UPDATE/DELETE
Update database connections require additional permissions to INSERT/UPDATE/DELETE
data, as well as creating temporary tables.

It is recommended that a separate unix account is used for
Expand Down
8 changes: 0 additions & 8 deletions include/cgimap/backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <boost/program_options.hpp>
#include "cgimap/data_update.hpp"
#include "cgimap/data_selection.hpp"
#include "cgimap/oauth.hpp"

/* implement this interface to add a new backend which will be selectable
* on the command line.
Expand All @@ -37,9 +36,6 @@ struct backend {
// create a data update factory from the arguments passed to cgimap.
virtual std::unique_ptr<data_update::factory>
create_data_update(const boost::program_options::variables_map &) = 0;
// create an oauth store based on arguments.
virtual std::unique_ptr<oauth::store>
create_oauth_store(const boost::program_options::variables_map &) = 0;
};

// figures out which backend should be selected and adds its options to the
Expand All @@ -56,10 +52,6 @@ create_backend(const boost::program_options::variables_map &);
std::unique_ptr<data_update::factory>
create_update_backend(const boost::program_options::variables_map &);

// singleton call to create an OAuth store from options.
std::unique_ptr<oauth::store>
create_oauth_store(const boost::program_options::variables_map &);

// this function registers a backend for use when creating backends
// from user-provided options.
bool register_backend(std::unique_ptr<backend>);
Expand Down
34 changes: 0 additions & 34 deletions include/cgimap/backend/apidb/oauth_store.hpp

This file was deleted.

169 changes: 0 additions & 169 deletions include/cgimap/oauth.hpp

This file was deleted.

1 change: 0 additions & 1 deletion include/cgimap/oauth2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "cgimap/data_selection.hpp"
#include "cgimap/http.hpp"
#include "cgimap/oauth.hpp"
#include "cgimap/request_helpers.hpp"

namespace oauth2 {
Expand Down
49 changes: 0 additions & 49 deletions include/cgimap/oauth_io.hpp

This file was deleted.

14 changes: 0 additions & 14 deletions include/cgimap/options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class global_settings_base {
virtual std::optional<uint32_t> get_relation_max_members() const = 0;
virtual std::optional<uint32_t> get_element_max_tags() const = 0;
virtual bool get_basic_auth_support() const = 0;
virtual bool get_oauth_10_support() const = 0;
virtual uint32_t get_ratelimiter_ratelimit(bool) const = 0;
virtual uint32_t get_ratelimiter_maxdebt(bool) const = 0;
virtual bool get_ratelimiter_upload() const = 0;
Expand Down Expand Up @@ -86,10 +85,6 @@ class global_settings_default : public global_settings_base {
return true;
}

bool get_oauth_10_support() const override {
return true;
}

uint32_t get_ratelimiter_ratelimit(bool moderator) const override {
if (moderator) {
return 1024 * 1024; // 1MB/s
Expand Down Expand Up @@ -171,10 +166,6 @@ class global_settings_via_options : public global_settings_base {
return m_basic_auth_support;
}

bool get_oauth_10_support() const override {
return m_oauth_10_support;
}

uint32_t get_ratelimiter_ratelimit(bool moderator) const override {
if (moderator) {
return m_moderator_ratelimiter_ratelimit;
Expand Down Expand Up @@ -207,7 +198,6 @@ class global_settings_via_options : public global_settings_base {
void set_relation_max_members(const po::variables_map &options);
void set_element_max_tags(const po::variables_map &options);
void set_basic_auth_support(const po::variables_map &options);
void set_oauth_10_support(const po::variables_map &options);
void set_ratelimiter_ratelimit(const po::variables_map &options);
void set_ratelimiter_maxdebt(const po::variables_map &options);
void set_ratelimiter_upload(const po::variables_map &options);
Expand All @@ -224,7 +214,6 @@ class global_settings_via_options : public global_settings_base {
std::optional<uint32_t> m_relation_max_members;
std::optional<uint32_t> m_element_max_tags;
bool m_basic_auth_support;
bool m_oauth_10_support;
uint32_t m_ratelimiter_ratelimit;
uint32_t m_moderator_ratelimiter_ratelimit;
uint32_t m_ratelimiter_maxdebt;
Expand Down Expand Up @@ -272,9 +261,6 @@ class global_settings final {
// Enable HTTP basic authentication support
static bool get_basic_auth_support() { return settings->get_basic_auth_support(); }

// Enable legacy OAuth 1.0 support
static bool get_oauth_10_support() { return settings->get_oauth_10_support(); }

// average number of bytes/s to allow each client/moderator
static uint32_t get_ratelimiter_ratelimit(bool moderator) { return settings->get_ratelimiter_ratelimit(moderator); }

Expand Down
4 changes: 1 addition & 3 deletions include/cgimap/process_request.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "cgimap/data_selection.hpp"
#include "cgimap/routes.hpp"
#include "cgimap/basicauth.hpp"
#include "cgimap/oauth.hpp"
#include "cgimap/oauth2.hpp"
#include <string>

Expand All @@ -26,7 +25,6 @@
void process_request(request &req, rate_limiter &limiter,
const std::string &generator, const routes &route,
data_selection::factory& factory,
data_update::factory* update_factory,
oauth::store* store = nullptr);
data_update::factory* update_factory);

#endif /* PROCESS_REQUEST_HPP */
Loading

0 comments on commit 6dd16a5

Please sign in to comment.