13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/wcc/contentful/webhook_controller.rb', line 13
def authorize_contentful
config = WCC::Contentful.configuration
if config.webhook_username.present? && config.webhook_password.present?
unless authenticate_with_http_basic do |u, p|
u == config.webhook_username &&
p == config.webhook_password
end
request_http_basic_authentication
return
end
end
return if request.content_type == 'application/vnd.contentful.management.v1+json'
render json: { msg: 'This endpoint only responds to webhooks from Contentful' }, status: 406
end
|