oneaws 0.1.3 → 0.2.0

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: 206db80babfc5a4ec457c5f4f6a3a5d39c27d80651174f23a527b93601c16f39
4
- data.tar.gz: 0daa2f9d03f81cd2a43b0e5474b2987346b2fbf21b6824b8a7f7dc7c7642b096
3
+ metadata.gz: 4246492bb2bb3db3d687669b230897b097f2962c381822b7bbc5acd194d3af4b
4
+ data.tar.gz: 3e0a5e9de75af06e83671bc1bf89133ee6fdef8f68a367f7c520a0a9b89cfed2
5
5
  SHA512:
6
- metadata.gz: 8a43e2ccf892638a0565e1b81998c08367298f017e09bfb8c9013b8a9f71746e84607b95899fd09a96edeaec73cac4b7805a973e1119bc14a7ff3b21142fdfef
7
- data.tar.gz: 8eb123cd6ad1130c70bdb8d085668a4b66f1fc4030d88861e722d1294a0f48a8d72fb51ff8029ee6150c90dc33a9067ce5fb65cec7c2b3f206374b551d5b3573
6
+ metadata.gz: 76c21fcd42010ad553aa036898f3b629f920409713dd494a02e18683794924c3d5989f03ae1f8243fb5b794d8d238945646915c9e5cc6d4d555041baeb1f173c
7
+ data.tar.gz: 3b7dba5bd0457b20273ab25f56f9ca3ec78b7ef4a0abe1ec8385ce801cc2ad378e95ed2c4edc7161d5929135172b8f522902c3b497a47985a5a31be03725198f
data/lib/oneaws/client.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'onelogin'
2
2
  require 'aws-sdk-core'
3
+ require 'io/console'
3
4
 
4
5
  module Oneaws
5
6
  class Client
@@ -32,13 +33,23 @@ module Oneaws
32
33
  mfa = response.mfa
33
34
 
34
35
  # sent push notification to OneLogin Protect
35
- mfa_device = mfa.devices.select{|device| device.type == "OneLogin Protect"}&.first
36
+ mfa_device = mfa.devices.first
36
37
 
37
38
  if mfa_device.nil?
38
- raise MfaDeviceNotFoundError.new("OneLogin Protect device not found.")
39
+ raise MfaDeviceNotFoundError.new("MFA device not found.")
39
40
  end
40
41
 
41
- response = @onelogin.get_saml_assertion_verifying(app_id, mfa_device.id, mfa.state_token, nil, nil, false)
42
+ device_types_that_do_not_require_token = [
43
+ "OneLogin Protect"
44
+ ]
45
+
46
+ otp_token = unless device_types_that_do_not_require_token.include?(mfa_device.type)
47
+ print "input OTP of #{mfa_device.type}: "
48
+ STDIN.noecho(&:gets)
49
+ end
50
+
51
+ response = @onelogin.get_saml_assertion_verifying(app_id, mfa_device.id, mfa.state_token, otp_token, nil, false)
52
+
42
53
  if response.nil?
43
54
  raise SamlRequestError.new("#{@onelogin.error} #{@onelogin.error_description}")
44
55
  end
@@ -1,3 +1,3 @@
1
1
  module Oneaws
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oneaws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Koya
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-13 00:00:00.000000000 Z
11
+ date: 2023-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -93,7 +93,7 @@ metadata:
93
93
  homepage_uri: https://github.com/pepabo/oneaws
94
94
  source_code_uri: https://github.com/pepabo/oneaws
95
95
  changelog_uri: https://github.com/pepabo/oneaws
96
- post_install_message:
96
+ post_install_message:
97
97
  rdoc_options: []
98
98
  require_paths:
99
99
  - lib
@@ -108,8 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.1.2
112
- signing_key:
111
+ rubygems_version: 3.3.26
112
+ signing_key:
113
113
  specification_version: 4
114
114
  summary: Issue temporary credentials using OneLogin and AWS STS.
115
115
  test_files: []