Class: RightScale::LoginPolicy
- Includes:
- Serializable
- Defined in:
- lib/right_agent/core_payload_types/login_policy.rb
Overview
List of authorized users for Managed Login feature
Constant Summary collapse
- PUBLIC_KEY_REGEXP =
/(.*)?(ssh-[a-z]{1,3})\s+(\S+)\s*(.*)?$/
Instance Attribute Summary collapse
-
#audit_id ⇒ Object
Returns the value of attribute audit_id.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#exclusive ⇒ Object
Returns the value of attribute exclusive.
-
#users ⇒ Object
Returns the value of attribute users.
Class Method Summary collapse
-
.parse_public_key(str) ⇒ Object
Utility method to parse an SSH2-format public key and return a 4-tuple consisting of its constituent parts: * leading comment (optional) * algorithm (ssh-rsa or ssh-dsa) * public key material, as a base64 string * trailing comment or email (optional).
Instance Method Summary collapse
-
#initialize(*args) ⇒ LoginPolicy
constructor
Initialize fields from given arguments.
-
#serialized_members ⇒ Object
Array of serialized fields given to constructor.
Methods included from Serializable
Constructor Details
#initialize(*args) ⇒ LoginPolicy
Initialize fields from given arguments
35 36 37 38 39 40 |
# File 'lib/right_agent/core_payload_types/login_policy.rb', line 35 def initialize(*args) @audit_id = args[0] @created_at = Time.at( (args[1]||Time.now).to_i ) @exclusive = args[2] || false @users = args[3] || [] end |
Instance Attribute Details
#audit_id ⇒ Object
Returns the value of attribute audit_id.
32 33 34 |
# File 'lib/right_agent/core_payload_types/login_policy.rb', line 32 def audit_id @audit_id end |
#created_at ⇒ Object
Returns the value of attribute created_at.
32 33 34 |
# File 'lib/right_agent/core_payload_types/login_policy.rb', line 32 def created_at @created_at end |
#exclusive ⇒ Object
Returns the value of attribute exclusive.
32 33 34 |
# File 'lib/right_agent/core_payload_types/login_policy.rb', line 32 def exclusive @exclusive end |
#users ⇒ Object
Returns the value of attribute users.
32 33 34 |
# File 'lib/right_agent/core_payload_types/login_policy.rb', line 32 def users @users end |
Class Method Details
.parse_public_key(str) ⇒ Object
Utility method to parse an SSH2-format public key and return a 4-tuple consisting of its constituent parts:
* leading comment (optional)
* algorithm (ssh-rsa or ssh-dsa)
* public key material, as a base64 string
* trailing comment or email (optional)
Parameters
- str(String)
-
the unparsed public key
Return
- components (Array|nil)
-
a 4-tuple of key components, or nil if the key was not a valid public key
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/right_agent/core_payload_types/login_policy.rb', line 60 def self.parse_public_key(str) match = PUBLIC_KEY_REGEXP.match(str) if match #Return a nice array of strings with no leading/trailing whitespace, and empty #strings transformed into nil return match[1..4].map { |x| x.strip! ; x.empty? ? nil : x } else return nil end end |
Instance Method Details
#serialized_members ⇒ Object
Array of serialized fields given to constructor
43 44 45 |
# File 'lib/right_agent/core_payload_types/login_policy.rb', line 43 def serialized_members [ @audit_id, @created_at.to_i, @exclusive, @users ] end |