Skip to content

Overriding ActiveResource::Connection clobbers any other HTTP Basic Auth #3

@theworkerant

Description

@theworkerant

The code below makes it impossible to use Basic Auth anywhere else in your app once the lighthouse API gem is included.

Why not set self.user and self.password on the Lighthouse::Base which inherits from ActiveResource?

module ActiveResource
  class Connection
    private
      def authorization_header
        (Lighthouse.email || Lighthouse.password ? { 'Authorization' => 'Basic ' + ["#{Lighthouse.email}:#{Lighthouse.password}"].pack('m').delete("\r\n") } : {})
      end
  end
end 

Metadata

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