diff options
Diffstat (limited to 'app')
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 |