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

Document AC::Connection::Authorization#reject_unauthorized_connection

This method is repeatedly used throughout the docs (in the [AC::Connection docs](12b6849858/actioncable/lib/action_cable/connection/base.rb (L28)), the [AC README](12b6849858/actioncable/README.md (a-full-stack-example)), the [AC Guides](12b6849858/guides/source/action_cable_overview.md (connection-setup))), but not actually documented itself and seemingly not supported for public use based on its current `private` status.

This actually makes the method public and documents it.  The actual behavior that’s documented here is implemented [here](12b6849858/actioncable/lib/action_cable/connection/base.rb (L213-L219)), via [this rescuing of the UnauthorizedError](3dd1de8ba4/actioncable/lib/action_cable/connection/base.rb (L172)).

The method is [already tested here](25473baf40/actioncable/test/connection/authorization_test.rb (L17-L29)).
This commit is contained in:
T.J. Schuck 2017-03-22 18:48:08 -04:00
parent 3dd1de8ba4
commit 11a09dbe53

View file

@ -3,11 +3,11 @@ module ActionCable
module Authorization
class UnauthorizedError < StandardError; end
private
def reject_unauthorized_connection
logger.error "An unauthorized connection attempt was rejected"
raise UnauthorizedError
end
# Closes the \WebSocket connection if it is open and returns a 404 "File not Found" response.
def reject_unauthorized_connection
logger.error "An unauthorized connection attempt was rejected"
raise UnauthorizedError
end
end
end
end