Class: BasicAuthCredentials
- Inherits:
-
Object
- Object
- BasicAuthCredentials
- Defined in:
- lib/basic_auth_credentials.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#initialize(encoded_credentials) ⇒ BasicAuthCredentials
constructor
A new instance of BasicAuthCredentials.
Constructor Details
#initialize(encoded_credentials) ⇒ BasicAuthCredentials
Returns a new instance of BasicAuthCredentials.
6 7 8 9 10 11 |
# File 'lib/basic_auth_credentials.rb', line 6 def initialize(encoded_credentials) encoded_credentials ||= '' encoded_credentials.sub!(/^Basic\s+/, '') decoded = Base64.decode64(encoded_credentials) @user_id, @password = decoded.split(':', 2) end |
Instance Attribute Details
#password ⇒ Object (readonly)
Returns the value of attribute password.
4 5 6 |
# File 'lib/basic_auth_credentials.rb', line 4 def password @password end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
4 5 6 |
# File 'lib/basic_auth_credentials.rb', line 4 def user_id @user_id end |