Sha256: 6923877382f5646042db872fd615bd940c7fe889a22ed5fb893ce2ff4a493526

Contents?: true

Size: 501 Bytes

Versions: 32

Compression:

Stored size: 501 Bytes

Contents

require 'base64'

module Restfully
  module Rack
    class BasicAuth
      def initialize(app, username, password)
        @app = app
        @username = username
        @password = password
      end
      
      def call(env)
        env['HTTP_AUTHORIZATION'] = [
          "Basic",
          Base64.encode64([
            @username,
            @password
          ].join(":"))
        ].join(" ")
        
        @app.call(env)
      end
      
    end # class BasicAuth
  end # module Rack
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
restfully-1.3.0 lib/restfully/rack/basic_auth.rb
restfully-1.2.0 lib/restfully/rack/basic_auth.rb
restfully-1.1.1 lib/restfully/rack/basic_auth.rb
restfully-1.1.0 lib/restfully/rack/basic_auth.rb
restfully-1.0.8 lib/restfully/rack/basic_auth.rb
restfully-1.0.7 lib/restfully/rack/basic_auth.rb
restfully-1.0.6 lib/restfully/rack/basic_auth.rb
restfully-1.0.5 lib/restfully/rack/basic_auth.rb
restfully-1.0.4 lib/restfully/rack/basic_auth.rb
restfully-1.0.3 lib/restfully/rack/basic_auth.rb
restfully-1.0.2 lib/restfully/rack/basic_auth.rb
restfully-1.0.1 lib/restfully/rack/basic_auth.rb
restfully-1.0.0 lib/restfully/rack/basic_auth.rb
restfully-1.0.0.rc2 lib/restfully/rack/basic_auth.rb
restfully-1.0.0.rc1 lib/restfully/rack/basic_auth.rb
restfully-0.8.8 lib/restfully/rack/basic_auth.rb
restfully-0.8.7 lib/restfully/rack/basic_auth.rb
restfully-0.8.6 lib/restfully/rack/basic_auth.rb
restfully-0.8.5 lib/restfully/rack/basic_auth.rb
restfully-0.8.4 lib/restfully/rack/basic_auth.rb