Class: RightScale::LoginUser
- Includes:
- Serializable
- Defined in:
- lib/right_agent/core_payload_types/login_user.rb
Overview
Authorized user for the Managed Login feature
Instance Attribute Summary collapse
-
#common_name ⇒ Object
Returns the value of attribute common_name.
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#profile_data ⇒ Object
Returns the value of attribute profile_data.
-
#public_key ⇒ Object
Returns the value of attribute public_key.
-
#public_key_fingerprints ⇒ Object
Returns the value of attribute public_key_fingerprints.
-
#public_keys ⇒ Object
Returns the value of attribute public_keys.
-
#superuser ⇒ Object
Returns the value of attribute superuser.
-
#username ⇒ Object
Returns the value of attribute username.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Class Method Summary collapse
-
.fingerprint(public_key) ⇒ Object
Create fingerprint for public key.
Instance Method Summary collapse
-
#initialize(*args) ⇒ LoginUser
constructor
Initialize fields from given arguments.
-
#serialized_members ⇒ Object
Array of serialized fields given to constructor.
Methods included from Serializable
Constructor Details
#initialize(*args) ⇒ LoginUser
Initialize fields from given arguments
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/right_agent/core_payload_types/login_user.rb', line 37 def initialize(*args) @uuid = args[0] @username = args[1] @public_key = args[2] @common_name = args[3] || '' @superuser = args[4] || false @expires_at = Time.at(args[5]) if args[5] && (args[5] != 0) # nil -> 0 because of expires_at.to_i below @public_keys = args[6] @profile_data = args[7] @public_key_fingerprints = args[8] # We now expect an array of public_keys to be passed while supporting the # singular public_key as a legacy member. When serialized back from a # legacy LoginUser record, the singular value may be set while the plural # is nil. if @public_keys raise ArgumentError, "Expected public_keys (seventh argument) to be an array" unless @public_keys.is_a?(Array) @public_key = @public_keys.first else raise ArgumentError, "Expected public_key (third argument) to be a string" unless @public_key.is_a?(String) @public_keys = [@public_key] end # The number of fingerprints must match the number of public keys if @public_key_fingerprints && @public_key_fingerprints.size != @public_keys.size raise ArgumentError, "Expected public_keys (seventh argument) array length (#{@public_keys.size}) is not " + "the same as the public_key_fingerprints (eighth argument) (#{@public_key_fingerprints.size})" end end |
Instance Attribute Details
#common_name ⇒ Object
Returns the value of attribute common_name.
33 34 35 |
# File 'lib/right_agent/core_payload_types/login_user.rb', line 33 def common_name @common_name end |
#expires_at ⇒ Object
Returns the value of attribute expires_at.
33 34 35 |
# File 'lib/right_agent/core_payload_types/login_user.rb', line 33 def expires_at @expires_at end |
#profile_data ⇒ Object
Returns the value of attribute profile_data.
33 34 35 |
# File 'lib/right_agent/core_payload_types/login_user.rb', line 33 def profile_data @profile_data end |
#public_key ⇒ Object
Returns the value of attribute public_key.
33 34 35 |
# File 'lib/right_agent/core_payload_types/login_user.rb', line 33 def public_key @public_key end |
#public_key_fingerprints ⇒ Object
Returns the value of attribute public_key_fingerprints.
33 34 35 |
# File 'lib/right_agent/core_payload_types/login_user.rb', line 33 def public_key_fingerprints @public_key_fingerprints end |
#public_keys ⇒ Object
Returns the value of attribute public_keys.
33 34 35 |
# File 'lib/right_agent/core_payload_types/login_user.rb', line 33 def public_keys @public_keys end |
#superuser ⇒ Object
Returns the value of attribute superuser.
33 34 35 |
# File 'lib/right_agent/core_payload_types/login_user.rb', line 33 def superuser @superuser end |
#username ⇒ Object
Returns the value of attribute username.
33 34 35 |
# File 'lib/right_agent/core_payload_types/login_user.rb', line 33 def username @username end |
#uuid ⇒ Object
Returns the value of attribute uuid.
33 34 35 |
# File 'lib/right_agent/core_payload_types/login_user.rb', line 33 def uuid @uuid end |
Class Method Details
.fingerprint(public_key) ⇒ Object
Create fingerprint for public key
74 75 76 |
# File 'lib/right_agent/core_payload_types/login_user.rb', line 74 def self.fingerprint(public_key) Digest::SHA1.hexdigest(::Net::SSH::KeyFactory.load_data_public_key(public_key).to_der) end |
Instance Method Details
#serialized_members ⇒ Object
Array of serialized fields given to constructor
68 69 70 71 |
# File 'lib/right_agent/core_payload_types/login_user.rb', line 68 def serialized_members [ @uuid, @username, @public_key, @common_name, @superuser, @expires_at.to_i, @public_keys, @profile_data, @public_key_fingerprints ] end |