Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth 1.0a removal #354

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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