Class: Sailpoint::Configuration
- Defined in:
- lib/sailpoint/configuration.rb
Overview
Used for setting API configuration before creating API Requests Configuration can include: username, password, interface, host, url
Constant Summary collapse
- ALLOWED_INTERFACES =
%w[rest scim].freeze
Instance Attribute Summary collapse
-
#host_val ⇒ Object
Variables used for storing values for host= and interface=.
-
#interface_val ⇒ Object
Variables used for storing values for host= and interface=.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#auth_header ⇒ String
Used for generating the API BasicAuth Header when creating an API request.
-
#credentials ⇒ String
Used for fetching the API credentials when setting API requests headers.
- #full_host(interface = '') ⇒ Object
-
#hashed_credentials ⇒ String
SailPoints auth requires a Base64 string of (username:password) This is how most BasicAuth authentication methods work.
- #host ⇒ Object
- #host=(val = nil) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #interface ⇒ Object
- #interface=(val = nil) ⇒ Object
-
#interface_path ⇒ String
Used for fetching the API interface_path based on the API interface specification.
-
#url ⇒ String
Used for fetching the requesting users entire URL (Host+Interface).
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
18 19 20 |
# File 'lib/sailpoint/configuration.rb', line 18 def initialize reload_config end |
Instance Attribute Details
#host_val ⇒ Object
Variables used for storing values for host= and interface=
16 17 18 |
# File 'lib/sailpoint/configuration.rb', line 16 def host_val @host_val end |
#interface_val ⇒ Object
Variables used for storing values for host= and interface=
16 17 18 |
# File 'lib/sailpoint/configuration.rb', line 16 def interface_val @interface_val end |
#password ⇒ Object
Returns the value of attribute password.
13 14 15 |
# File 'lib/sailpoint/configuration.rb', line 13 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
13 14 15 |
# File 'lib/sailpoint/configuration.rb', line 13 def username @username end |
Instance Method Details
#auth_header ⇒ String
Used for generating the API BasicAuth Header when creating an API request
82 83 84 85 86 |
# File 'lib/sailpoint/configuration.rb', line 82 def auth_header return {}.freeze if username.blank? && password.blank? { 'Authorization' => "Basic #{hashed_credentials}" }.freeze end |
#credentials ⇒ String
Used for fetching the API credentials when setting API requests headers
76 77 78 |
# File 'lib/sailpoint/configuration.rb', line 76 def credentials { username: username, password: password }.freeze end |
#full_host(interface = '') ⇒ Object
70 71 72 |
# File 'lib/sailpoint/configuration.rb', line 70 def full_host(interface = '') (interface.blank? ? [host, 'identityiq', interface_path].join('/') : [host, 'identityiq', interface].join('/')) end |
#hashed_credentials ⇒ String
SailPoints auth requires a Base64 string of (username:password) This is how most BasicAuth authentication methods work
48 49 50 51 52 |
# File 'lib/sailpoint/configuration.rb', line 48 def hashed_credentials return '' if username.blank? && password.blank? Base64.encode64("#{username}:#{password}").strip end |
#host ⇒ Object
26 27 28 |
# File 'lib/sailpoint/configuration.rb', line 26 def host host_val end |
#host=(val = nil) ⇒ Object
22 23 24 |
# File 'lib/sailpoint/configuration.rb', line 22 def host=(val = nil) self.host_val = trim_host(val) end |
#interface ⇒ Object
41 42 43 |
# File 'lib/sailpoint/configuration.rb', line 41 def interface interface_val end |
#interface=(val = nil) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/sailpoint/configuration.rb', line 30 def interface=(val = nil) val = val&.to_s&.strip unless val.blank? self.interface_val = begin if val.blank? || !ALLOWED_INTERFACES.include?(val) 'scim' else val end end end |
#interface_path ⇒ String
Used for fetching the API interface_path based on the API interface specification
56 57 58 59 60 |
# File 'lib/sailpoint/configuration.rb', line 56 def interface_path return 'scim' if interface.blank? || !ALLOWED_INTERFACES.include?(interface) interface end |
#url ⇒ String
Used for fetching the requesting users entire URL (Host+Interface)
64 65 66 67 68 |
# File 'lib/sailpoint/configuration.rb', line 64 def url return '' if host.blank? || interface.blank? full_host(interface) end |