Class: Docker::Remote::AuthInfo
- Inherits:
-
Object
- Object
- Docker::Remote::AuthInfo
- Defined in:
- lib/docker/remote/auth_info.rb
Instance Attribute Summary collapse
-
#auth_type ⇒ Object
readonly
Returns the value of attribute auth_type.
-
#creds ⇒ Object
readonly
Returns the value of attribute creds.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(auth_type, params, creds) ⇒ AuthInfo
constructor
A new instance of AuthInfo.
- #strategy ⇒ Object
Constructor Details
#initialize(auth_type, params, creds) ⇒ AuthInfo
Returns a new instance of AuthInfo.
21 22 23 24 25 |
# File 'lib/docker/remote/auth_info.rb', line 21 def initialize(auth_type, params, creds) @auth_type = auth_type @params = params @creds = creds end |
Instance Attribute Details
#auth_type ⇒ Object (readonly)
Returns the value of attribute auth_type.
19 20 21 |
# File 'lib/docker/remote/auth_info.rb', line 19 def auth_type @auth_type end |
#creds ⇒ Object (readonly)
Returns the value of attribute creds.
19 20 21 |
# File 'lib/docker/remote/auth_info.rb', line 19 def creds @creds end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
19 20 21 |
# File 'lib/docker/remote/auth_info.rb', line 19 def params @params end |
Class Method Details
.from_header(header, creds) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/docker/remote/auth_info.rb', line 5 def from_header(header, creds) idx = header.index(' ') auth_type = header[0..idx].strip.downcase params = header[idx..-1].split(',').each_with_object({}) do |param, ret| key, value = param.split('=') ret[key.strip] = value.strip[1..-2] # remove quotes end new(auth_type, params, creds) end |
Instance Method Details
#strategy ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/docker/remote/auth_info.rb', line 27 def strategy @strategy ||= case auth_type when 'bearer' BearerAuth.new(self, creds) when 'basic' BasicAuth.new(creds) else raise UnsupportedAuthTypeError, "unsupported Docker auth type '#{auth_type}'" end end |