Skip to content

Commit 07f87c6

Browse files
committed
Fix authentication_proc intended usage
1 parent 9f6340f commit 07f87c6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ Set admin username and password in an initializer:
4444
# config/initializers/api_doc_server.rb
4545
4646
ApiDocServer.configure do |config|
47-
config.authentication_proc = proc do |controller|
48-
controller.authenticate_or_request_with_http_basic do |username, password|
47+
config.authentication_proc = proc
48+
authenticate_or_request_with_http_basic do |username, password|
4949
User.find_by(name: username, password: password)
5050
end
5151
end

app/controllers/api_doc_server/application_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base
1111
protected
1212

1313
def authenticate_admin
14-
ApiDocServer.configuration.authentication_proc.call(self)
14+
instance_exec &ApiDocServer.configuration.authentication_proc
1515
end
1616
end
1717
end

0 commit comments

Comments
 (0)