aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2018-11-05 09:56:02 -0500
committerGeorge Claghorn <george@basecamp.com>2018-11-05 09:56:08 -0500
commitd02ae4c7ae336412a5ff19400cda6b87ed58a465 (patch)
treeea07b330a7660179a5638368cd62a87c69a24ae2
parent7755f9b381c007ce98e0858473a9f29f1cd25311 (diff)
downloadrails-d02ae4c7ae336412a5ff19400cda6b87ed58a465.tar.gz
rails-d02ae4c7ae336412a5ff19400cda6b87ed58a465.tar.bz2
rails-d02ae4c7ae336412a5ff19400cda6b87ed58a465.zip
Rename authentication callbacks
-rw-r--r--app/controllers/action_mailbox/ingresses/amazon/inbound_emails_controller.rb10
-rw-r--r--app/controllers/action_mailbox/ingresses/mailgun/inbound_emails_controller.rb4
-rw-r--r--app/controllers/action_mailbox/ingresses/mandrill/inbound_emails_controller.rb4
3 files changed, 7 insertions, 11 deletions
diff --git a/app/controllers/action_mailbox/ingresses/amazon/inbound_emails_controller.rb b/app/controllers/action_mailbox/ingresses/amazon/inbound_emails_controller.rb
index 557d1aeb04..4d56e27c76 100644
--- a/app/controllers/action_mailbox/ingresses/amazon/inbound_emails_controller.rb
+++ b/app/controllers/action_mailbox/ingresses/amazon/inbound_emails_controller.rb
@@ -1,5 +1,5 @@
class ActionMailbox::Ingresses::Amazon::InboundEmailsController < ActionMailbox::BaseController
- before_action :ensure_verified
+ before_action :authenticate
# TODO: Lazy-load the AWS SDK
require "aws-sdk-sns/message_verifier"
@@ -10,11 +10,7 @@ class ActionMailbox::Ingresses::Amazon::InboundEmailsController < ActionMailbox:
end
private
- def ensure_verified
- head :unauthorized unless verified?
- end
-
- def verified?
- verifier.authentic?(request.body)
+ def authenticate
+ head :unauthorized unless verifier.authentic?(request.body)
end
end
diff --git a/app/controllers/action_mailbox/ingresses/mailgun/inbound_emails_controller.rb b/app/controllers/action_mailbox/ingresses/mailgun/inbound_emails_controller.rb
index 0b763dcf18..e878192603 100644
--- a/app/controllers/action_mailbox/ingresses/mailgun/inbound_emails_controller.rb
+++ b/app/controllers/action_mailbox/ingresses/mailgun/inbound_emails_controller.rb
@@ -1,12 +1,12 @@
class ActionMailbox::Ingresses::Mailgun::InboundEmailsController < ActionMailbox::BaseController
- before_action :ensure_authenticated
+ before_action :authenticate
def create
ActionMailbox::InboundEmail.create_and_extract_message_id! params.require("body-mime")
end
private
- def ensure_authenticated
+ def authenticate
head :unauthorized unless authenticated?
end
diff --git a/app/controllers/action_mailbox/ingresses/mandrill/inbound_emails_controller.rb b/app/controllers/action_mailbox/ingresses/mandrill/inbound_emails_controller.rb
index 0601125cdb..b32b254076 100644
--- a/app/controllers/action_mailbox/ingresses/mandrill/inbound_emails_controller.rb
+++ b/app/controllers/action_mailbox/ingresses/mandrill/inbound_emails_controller.rb
@@ -1,5 +1,5 @@
class ActionMailbox::Ingresses::Mandrill::InboundEmailsController < ActionMailbox::BaseController
- before_action :ensure_authenticated
+ before_action :authenticate
def create
raw_emails.each { |raw_email| ActionMailbox::InboundEmail.create_and_extract_message_id! raw_email }
@@ -19,7 +19,7 @@ class ActionMailbox::Ingresses::Mandrill::InboundEmailsController < ActionMailbo
end
- def ensure_authenticated
+ def authenticate
head :unauthorized unless authenticated?
end