wm_okta_helper 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wm_okta_helper/create_session.rb +26 -9
- data/lib/wm_okta_helper/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6369d84a44dda8f3a16ccf5b232aa7a1446c45e5
|
4
|
+
data.tar.gz: de9f5bf350ced727a9d9a6604febe31d0ba9add3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00d9db751bccdb0241708e83c46f5e3e8863336032fc60faae229963328b6e5383433cd0fd141d3e7b88da0b12ad057eb5e53dacb71fdd0462b1418ecab1b760
|
7
|
+
data.tar.gz: b767230462343ccb9a56a51be2986bc6fd592ce9be9651f834d9673e749e295caf69bc7be96cbbcd8c601d47995cd3b2dbc7fcaabe5ab96b090382df904d3dbb
|
@@ -3,25 +3,35 @@
|
|
3
3
|
module WmOktaHelper
|
4
4
|
class CreateSession
|
5
5
|
def initialize(options)
|
6
|
-
@
|
7
|
-
@password = options[:password]
|
8
|
-
@okta_org = options[:okta_org]
|
9
|
-
@okta_domain = options[:okta_domain]
|
6
|
+
@options = options
|
10
7
|
end
|
11
8
|
|
12
9
|
def call
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
).call
|
10
|
+
check_options
|
11
|
+
raise 'Not authorized' if response['sessionToken'].blank?
|
12
|
+
response
|
17
13
|
end
|
18
14
|
|
19
15
|
attr_accessor :username, :password, :okta_org, :okta_domain
|
20
16
|
|
21
17
|
private
|
22
18
|
|
19
|
+
def available_options
|
20
|
+
%i[username password okta_org okta_domain]
|
21
|
+
end
|
22
|
+
|
23
|
+
def check_options
|
24
|
+
missing_options = available_options.select { |o| @options[o].blank? }
|
25
|
+
if missing_options.present?
|
26
|
+
raise "Missing configuration variable: #{missing_options}"
|
27
|
+
end
|
28
|
+
available_options.each do |o|
|
29
|
+
instance_variable_set("@#{o}", @options[o])
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
23
33
|
def url
|
24
|
-
"https://#{okta_org}.#{okta_domain}.com/api/v1/authn"
|
34
|
+
"https://#{@okta_org}.#{@okta_domain}.com/api/v1/authn"
|
25
35
|
end
|
26
36
|
|
27
37
|
def request_body
|
@@ -34,5 +44,12 @@ module WmOktaHelper
|
|
34
44
|
}
|
35
45
|
}
|
36
46
|
end
|
47
|
+
|
48
|
+
def response
|
49
|
+
@response ||= PostRequest.new(
|
50
|
+
url: url,
|
51
|
+
request_body: request_body
|
52
|
+
).call
|
53
|
+
end
|
37
54
|
end
|
38
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wm_okta_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jose C Fernandez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-jwt
|
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
199
|
version: '0'
|
200
200
|
requirements: []
|
201
201
|
rubyforge_project:
|
202
|
-
rubygems_version: 2.6.14
|
202
|
+
rubygems_version: 2.6.14.1
|
203
203
|
signing_key:
|
204
204
|
specification_version: 4
|
205
205
|
summary: Helper library for validating Okta jwt token.
|