diff options
Diffstat (limited to 'app/controllers/projects/alerting/notifications_controller.rb')
-rw-r--r-- | app/controllers/projects/alerting/notifications_controller.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/projects/alerting/notifications_controller.rb b/app/controllers/projects/alerting/notifications_controller.rb index db5d91308db..95b403faf55 100644 --- a/app/controllers/projects/alerting/notifications_controller.rb +++ b/app/controllers/projects/alerting/notifications_controller.rb @@ -3,6 +3,8 @@ module Projects module Alerting class NotificationsController < Projects::ApplicationController + include ActionController::HttpAuthentication::Basic + respond_to :json skip_before_action :verify_authenticity_token @@ -27,9 +29,19 @@ module Projects end def extract_alert_manager_token(request) + extract_bearer_token(request) || extract_basic_auth_token(request) + end + + def extract_bearer_token(request) Doorkeeper::OAuth::Token.from_bearer_authorization(request) end + def extract_basic_auth_token(request) + _username, token = user_name_and_password(request) + + token + end + def notify_service notify_service_class.new(project, notification_payload) end |