Sha256: 1a64a47709032dd97d8c077c1c84530a9a5a796f66aaf266694195cd397500b0

Contents?: true

Size: 374 Bytes

Versions: 5

Compression:

Stored size: 374 Bytes

Contents

module ApplicationCable
  class Connection < ActionCable::Connection::Base
    identified_by :current_user

    def connect
      set_current_user || reject_unauthorized_connection
    end

    private
      def set_current_user
        if session = Session.find_by(id: cookies.signed[:session_id])
          self.current_user = session.user
        end
      end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
tm_lyn-0.1.0 app/channels/application_cable/connection.rb
railties-8.0.1 lib/rails/generators/rails/authentication/templates/app/channels/application_cable/connection.rb.tt
railties-8.0.0.1 lib/rails/generators/rails/authentication/templates/app/channels/application_cable/connection.rb.tt
railties-8.0.0 lib/rails/generators/rails/authentication/templates/app/channels/application_cable/connection.rb.tt
railties-8.0.0.rc2 lib/rails/generators/rails/authentication/templates/app/channels/application_cable/connection.rb.tt