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)


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

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

#credentialsObject



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

def credentials
  @credentials ||= params.unpack1('m').split(':', 2)
end

#usernameObject



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

def username
  credentials.first
end