sailpoint 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8faa7517c8f7dc3f463e65c8fe1664c2bb114d1e0dea32a5de3c3daf3bf25501
4
- data.tar.gz: 754bb1d74249fc947d6e72983270be4c96ff0433b787fc60a41d7ec36834bf92
3
+ metadata.gz: d6bf86899f091940b968757d594603b5db984e6d89cdd999787b873f86bfe9ed
4
+ data.tar.gz: 442bfb5d83d550d3899e029d5234bac86c710059148a69dfbf32222f4442d02f
5
5
  SHA512:
6
- metadata.gz: dc00288d246b3f26652e2a173f56617b73e3fababe07219f1e1df435e48ba2be5691e0c732d31a5f9ab0382bff28ffbeee399b62f1c31d556a982086c92c4c31
7
- data.tar.gz: 7bc723c3372e745dcfd37a895a677e29b99ae7327f0c3c6b2896f5eedb8f7a87f65c5489073ab1da4338c9faf62da88a6251511f48f7d0f1cbac99bec59bb768
6
+ metadata.gz: 68c0c05d8f5c6a8fb53e1eb5655ce6e4418725820703734d60e9c2579b3ed727e307a8832389340e9bc5e2fadc92117e38c91dc3036660f0146dcc793cbe30fa
7
+ data.tar.gz: 663cc39a7e2bc3a73b1de299f07fd4721334aff2eac81aca2c7249f364e2bc2082739843a6369a6cf3dc15c094c30a842a8f367622790fbf9b6cd909aa9f7803
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
+
1
2
  # Sailpoint
2
3
 
4
+ ![Gem Version](https://img.shields.io/gem/v/sailpoint "SailPoint Gem version") [![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
5
+
6
+
3
7
  This is an unofficial tool for interactiving with Sailpoints [IdentityIQ's](https://www.sailpoint.com/solutions/identityiq/?elqct=Website&elqchannel=OrganicDirect) API interface. This gem assumes your IdenityIQ API is setup to authenticate using [BasicAuth](https://developer.sailpoint.com/SCIM/index.html#authentication) headers. If you require credentials for your SailPoint (IdenitityIQ) interface, I suggest contacting your system administrator before continuing any farther.
4
8
 
5
9
  **Note:** This gem doesn't include all possible IdentityIQ API requests, primarmly due to last of authorization to access much else. If you happen to have additional access to an IdentitiyIQ API it would be very much appreciated if you contributed any additional API requests.
@@ -45,11 +45,15 @@ module Sailpoint
45
45
  end
46
46
 
47
47
  # Used for fetching the requesting users entire URL (Host+Interface)
48
- # @param interface [String] - used for when the user is specicically calling an API such as <code>Sailpoint::Scim.get_user('username')</code>
48
+ # @param interface [String] - used for when the user is specicically calling an API such as <code>Unmh::Sailpoint::Scim.get_user('brhicks')</code>
49
49
  # @return [String] - Returns the entire requesting URL (based on host and interface type)
50
50
  def url(interface = '')
51
51
  return '' if @host.blank? || @interface.blank?
52
52
 
53
+ full_host(interface)
54
+ end
55
+
56
+ def full_host(interface = '')
53
57
  interface.blank? ? [trimmed_host, 'identityiq', interface_path].join('/') : [trimmed_host, 'identityiq', interface].join('/')
54
58
  end
55
59
 
@@ -11,6 +11,10 @@ class String
11
11
  def present?
12
12
  !self.nil?
13
13
  end
14
+
15
+ def escape_str
16
+ CGI.escape(self)
17
+ end
14
18
  end
15
19
 
16
20
  # Used to printout a [Red] message to STDOUT in case you want to print a message without causing an Exception.
@@ -25,7 +25,7 @@ module Sailpoint
25
25
 
26
26
  # the roles attribute should either be 'Contractor,Assistant' or ['Contractor', 'Assistant']
27
27
  roles = roles.join(',') if roles.is_a?(Array)
28
- response = HTTParty.get([Sailpoint::Config.url('rest'), "policies/checkRolePolicies?identity=#{identity}&roles=#{roles}"].join('/'),
28
+ response = HTTParty.get([Sailpoint::Config.url('rest'), "policies/checkRolePolicies?identity=#{identity.escape_str}&roles=#{roles}"].join('/'),
29
29
  headers: Sailpoint::Config.auth_header,
30
30
  output: 'json')
31
31
  JSON.parse(response&.body || '{}')
@@ -35,7 +35,7 @@ module Sailpoint
35
35
  # @param identity [String] - The user in which you are requesting data for
36
36
  # @return [Hash] - If no user if found an empty hash will be returned. If a a user is found, their parsed JSON will be returned as a result
37
37
  def self.get_identity(identity)
38
- response = HTTParty.get([Sailpoint::Config.url('rest'), 'identities', identity, 'managedIdentities'].join('/'),
38
+ response = HTTParty.get([Sailpoint::Config.url('rest'), 'identities', identity.escape_str, 'managedIdentities'].join('/'),
39
39
  headers: Sailpoint::Config.auth_header,
40
40
  output: 'json')
41
41
  return [] if response.code == '500'
@@ -47,7 +47,7 @@ module Sailpoint
47
47
  # @param identity [String] - The user in which you are requesting data for
48
48
  # @return [Hash] - If no user if found an empty hash will be returned. If a a user is found, their parsed JSON will be returned as a result
49
49
  def self.get_user(identity)
50
- response = HTTParty.get([Sailpoint::Config.url('rest'), 'identities', identity].join('/'),
50
+ response = HTTParty.get([Sailpoint::Config.url('rest'), 'identities', identity.escape_str].join('/'),
51
51
  headers: Sailpoint::Config.auth_header,
52
52
  output: 'json')
53
53
  raise AuthenticationException, 'Invalid credentials, please try again.' if response.code == 401
@@ -61,7 +61,7 @@ module Sailpoint
61
61
  # Before requesting a users roles we need to verify if the identiy matches a valid user first
62
62
  return {} if identity.blank? || get_user(identity).empty?
63
63
 
64
- response = HTTParty.get([Sailpoint::Config.url('rest'), "roles/assignablePermits/?roleMode=assignable&identity=#{identity}"].join('/'),
64
+ response = HTTParty.get([Sailpoint::Config.url('rest'), "roles/assignablePermits/?roleMode=assignable&identity=#{identity.escape_str}"].join('/'),
65
65
  headers: Sailpoint::Config.auth_header,
66
66
  output: 'json')
67
67
  response_body = JSON.parse(response&.body || '{}')
@@ -26,8 +26,7 @@ module Sailpoint
26
26
  # Used to fetch the specified users associated data
27
27
  # @return [Hash] - The users hashed data attributes
28
28
  def self.get_user(identity)
29
- puts [Sailpoint::Config.url('scim'), 'v2/Users', identity].join('/')
30
- response = HTTParty.get([Sailpoint::Config.url('scim'), 'v2/Users', identity].join('/'),
29
+ response = HTTParty.get([Sailpoint::Config.url('scim'), 'v2/Users', identity.escape_str].join('/'),
31
30
  headers: Sailpoint::Config.auth_header,
32
31
  output: 'json')
33
32
  # NOTE: If invalid credentials are supplied or the user could not be found response bodies contain a status code.
@@ -2,5 +2,5 @@ module Sailpoint
2
2
  # The minimum required RUBY_VERSION
3
3
  RUBY_VERSION = '2.5'.freeze
4
4
  # The Sailpoints version
5
- VERSION = '0.0.1'.freeze
5
+ VERSION = '0.0.2'.freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sailpoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Hicks
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-17 00:00:00.000000000 Z
11
+ date: 2019-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty