Class: Protocol::HTTP::Header::Authorization
- Inherits:
-
String
- Object
- String
- Protocol::HTTP::Header::Authorization
- Defined in:
- lib/protocol/http/header/authorization.rb
Overview
Used for basic authorization.
~~~ ruby headers.add(‘authorization’, Authorization.basic(“my_username”, “my_password”)) ~~~
Class Method Summary collapse
Instance Method Summary collapse
-
#credentials ⇒ Tuple(String, String)
Splits the header and.
Class Method Details
.basic(username, password) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/protocol/http/header/authorization.rb', line 40 def self.basic(username, password) encoded = "#{username}:#{password}" self.new( "Basic #{Base64.strict_encode64(encoded)}" ) end |
Instance Method Details
#credentials ⇒ Tuple(String, String)
Splits the header and
36 37 38 |
# File 'lib/protocol/http/header/authorization.rb', line 36 def credentials self.split(/\s+/, 2) end |