Module: Sailpoint

Defined in:
lib/sailpoint/rest.rb,
lib/sailpoint.rb,
lib/sailpoint/scim.rb,
lib/sailpoint/helpers.rb,
lib/sailpoint/version.rb,
lib/sailpoint/configuration.rb

Overview

Used for setting you Sailpoint API configuration and credentials

Defined Under Namespace

Classes: Configuration, Error, Helpers, Rest, Scim

Constant Summary collapse

RUBY_VERSION =

The minimum required RUBY_VERSION

'2.5'
VERSION =
'0.1.0'

Class Method Summary collapse

Class Method Details

.configObject



16
17
18
# File 'lib/sailpoint.rb', line 16

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



66
67
68
69
# File 'lib/sailpoint.rb', line 66

def configure
  self.config ||= config
  yield(config)
end

.get_user(username = '') ⇒ Hash

If a valid username and URL have been supplied a lookup requests will be send to determine if the user exists in the specified interface

Parameters:

  • username (String) (defaults to: '')
    • the username that we are going to valid exists in the IdentityIQ listing

Returns:

  • (Hash)
    • If a user is found, it will return all the that identities attributes

Raises:

  • (ArgumentError)


30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/sailpoint.rb', line 30

def get_user(username = '')
  raise ArgumentError, 'An invalid user lookup was specified.' if username.blank?
  raise ArgumentError, 'Please specify a valid HOST/Interface before attemping a lookup.' unless valid_url?
  raise ArgumentError, 'Valid credentials are required before attempting an API request.' unless valid_credentials?
  raise ArgumentError, 'Invalid interface type' unless valid_interface_type?(config.interface)

  if config.interface.blank?
    Sailpoint::Scim.get_user(username)
  else
    Object.const_get("Sailpoint::#{config.interface&.capitalize}").get_user(username)
  end
end

.mutexMutex

Used to memorize and create a Mutex to keep config in sync across running threads

Returns:

  • (Mutex)


23
24
25
# File 'lib/sailpoint.rb', line 23

def mutex
  @mutex ||= Mutex.new
end

.valid_credentials?Boolean

Used to verify if any credentails were supplied for the API request

Returns:

  • (Boolean)

    if credentials were supplied or not



45
46
47
48
49
# File 'lib/sailpoint.rb', line 45

def valid_credentials?
  return false if Sailpoint.config.username.blank? && Sailpoint.config.password.blank?

  !Sailpoint.config.hashed_credentials.blank?
end

.valid_interface_type?(interface = nil) ⇒ Boolean

Used to verify if the specifed interface type is valid for the Sailpoint API

Parameters:

  • interface (String) (defaults to: nil)
    • A specified API interface endpoint, that can either be ‘Rest` or `Scim`

Returns:

  • (Boolean)
    • Returns weither the specifed interface is a a valid type allowed by the API.



54
55
56
57
58
# File 'lib/sailpoint.rb', line 54

def valid_interface_type?(interface = nil)
  return false if interface.blank?

  Sailpoint::Configuration::ALLOWED_INTERFACES.include?(interface)
end

.valid_url?Boolean

Used to verify if the URL string is blank or a URL was supplied

Returns:

  • (Boolean)
    • if a url for the API endpoint was supplied or not



62
63
64
# File 'lib/sailpoint.rb', line 62

def valid_url?
  !Sailpoint.config.url.blank?
end