Class: Rack::Auth::Basic::Request

Inherits:
AbstractRequest show all
Defined in:
lib/rack/auth/basic.rb

Instance Method Summary collapse

Methods inherited from AbstractRequest

#initialize, #params, #parts, #provided?, #request, #scheme, #valid?

Constructor Details

This class inherits a constructor from Rack::Auth::AbstractRequest

Instance Method Details

#basic?Boolean

Returns:

  • (Boolean)

44
45
46
# File 'lib/rack/auth/basic.rb', line 44

def basic?
  "basic" == scheme && credentials.length == 2
end

#credentialsObject


48
49
50
# File 'lib/rack/auth/basic.rb', line 48

def credentials
  @credentials ||= Base64.decode64(params).split(':', 2)
end

#usernameObject


52
53
54
# File 'lib/rack/auth/basic.rb', line 52

def username
  credentials.first
end