Skip to content

Auhorization for verified users  #19

Closed
@lentrup

Description

I noticed that the gem only works when I am logged in. I am using devise.
Maybe we can add a hint that one needs to modify connection.rb or add something to the initializer of the gem?
connection.rb :

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

    def connect
      self.current_user = find_verified_user
    end

    private

    def find_verified_user
      if verified_user = env['warden'].user
        p verified_user
        verified_user
      else
        p verified_user
        reject_unauthorized_connection
      end
    end
  end
end

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions