Basic authentication helpers

上级 81bbf9ec
module ActionCable
module Connection
autoload :Authorization, 'action_cable/connection/authorization'
autoload :Base, 'action_cable/connection/base'
autoload :Heartbeat, 'action_cable/connection/heartbeat'
autoload :Identification, 'action_cable/connection/identification'
......
module ActionCable
module Connection
module Authorization
class UnauthorizedError < StandardError; end
private
def reject_unauthorized_connection
logger.error "An unauthorized connection attempt was rejected"
raise UnauthorizedError
end
end
end
end
\ No newline at end of file
......@@ -3,6 +3,7 @@ module Connection
class Base
include Identification
include InternalChannel
include Authorization
attr_reader :server, :env
delegate :worker_pool, :pubsub, to: :server
......@@ -85,6 +86,9 @@ def on_open
heartbeat.start
message_buffer.process!
rescue ActionCable::Connection::Authorization::UnauthorizedError
respond_to_invalid_request
close
end
def on_message(message)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册