1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Rename authentication callbacks

This commit is contained in:
George Claghorn 2018-11-05 09:56:02 -05:00
parent 7755f9b381
commit d02ae4c7ae
3 changed files with 7 additions and 11 deletions

View file

@ -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

View file

@ -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

View file

@ -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