aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable/connection/authorization.rb
blob: aef3386f71aeb092b4a5aa24426310835f292ce3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

module ActionCable
  module Connection
    module Authorization
      class UnauthorizedError < StandardError; 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