wire4_auth 1.0.0 → 1.1.1

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: 11e6f09a7250dc166b808ce1848453f257f2bff005c39d02c432b3b7c5fbde4c
4
- data.tar.gz: e245c3817860fb8fae1946af6d9125a35f3bd3e92d9eff6456965ceab5d1777e
3
+ metadata.gz: 5582b8a1cc4f3c18eed1fc8524c83a26222139a376baddfa7062f29bf17ee53f
4
+ data.tar.gz: 3efc1afdb3a161761c5c8e9b5ca6ec40ea8e77ff81364396786629c0d21836ad
5
5
  SHA512:
6
- metadata.gz: 9f2c8e57069f3cfa8e8f538cf1b503a259b78faa0fb902b2c38566b02ca45a7495dd04aae9c0523e7a2288e79094751651240a589ad90b029fbbc458722a7a90
7
- data.tar.gz: 2975be6c57a9ade65c5fc82d82ff8a4a38d53bdf8746ddac209ea5392f1f9f129d7cf01b385b08a39382263411c9dc87ac1359d9a8e952db6aba394fd07201a4
6
+ metadata.gz: d5fc0e90e8f75732b6428d7bdc48dfa88e59fa4c0ffc28163631aa87d2b7458be439d6ee858ea7ed6ce2a8ee476260df145a70ed193a35e82d4871502107801a
7
+ data.tar.gz: e9ffd5ec0d60bb907391aa1e4f3e868f337896fc2a035756c32ac965f7514e320d8a2a7ac395b8523aa866479f3f145933d646f3c72848c9744a39d9216e60da
data/Gemfile CHANGED
@@ -3,6 +3,6 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :development, :test do
6
- gem 'oauth2', '~> 1.4.2'
7
- gem 'wire4_client', '~> 1.0.0', path: "/Users/saintiago/tcpip/git-repositories/speiok/wire4-api-sdk-ruby/sdk-client"
6
+ gem 'oauth2', '~> 1.4.3'
7
+ gem 'wire4_client', '~> 1.1.1'
8
8
  end
@@ -47,37 +47,48 @@ module Wire4Auth
47
47
  @tokens_cached_app_user = {}
48
48
  end
49
49
 
50
+ #noinspection DuplicatedCode
50
51
  def obtain_access_token_app(scope = "general")
52
+ key_search = @client_id + scope
53
+ token_cached = @tokens_cached_app_user[key_search]
54
+ if !token_cached.nil? and !token_cached.access_token.nil? and !token_cached.access_token.params.nil? and
55
+ !token_cached.access_token.params['scope'].nil? and !token_cached.access_token.expires_at.nil? and
56
+ token_cached.access_token.expires_at.is_a? Integer and is_valid(token_cached.access_token.expires_at) and
57
+ !token_cached.access_token.token.nil?
51
58
 
52
- if !@token_cached_app.access_token.nil? and !@token_cached_app.access_token.params.nil? and
53
- !@token_cached_app.access_token.params['scope'].nil? and
54
- @token_cached_app.access_token.params['scope'].include? scope and
55
- !@token_cached_app.access_token.expires_at.nil? and @token_cached_app.access_token.expires_at.is_a? Integer and
56
- is_expire(@token_cached_app.access_token.expires_at) and !@token_cached_app.access_token.token.nil?
57
-
58
- return format_to_header(@token_cached_app.access_token.token)
59
+ return format_to_header(token_cached.access_token.token)
59
60
  end
60
61
 
61
62
  begin
62
63
  client = OAuth2::Client.new(@client_id, @client_secret, :token_url => @environment.token_url)
63
- access_token = client.get_token({:grant_type => "client_credentials", :scope => scope})
64
- @token_cached_app.access_token = access_token
64
+ access_token = client.get_token({ :grant_type => "client_credentials", :scope => scope})
65
+
66
+ if @tokens_cached_app_user.length + 1 > MAX_APP_USER_SIZE_CACHED
67
+ @tokens_cached_app_user.each_key do |key|
68
+ @tokens_cached_app_user.delete(key)
69
+ break
70
+ end
71
+ end
72
+
73
+ @tokens_cached_app_user[key_search] = Wire4Auth::CachedToken.new(@client_id, @client_secret, access_token)
65
74
 
66
75
  return format_to_header(access_token.token)
67
76
  rescue OAuth2::Error => e
68
77
  raise Wire4Client::ApiError.new(:code => e.code,
69
78
  :message => e.description)
70
79
  end
80
+
71
81
  end
72
82
 
83
+ #noinspection DuplicatedCode
73
84
  def obtain_access_token_app_user(user_key, secret_key, scope = "spei_admin")
74
85
 
75
86
  key_search = user_key + scope
76
87
  token_cached = @tokens_cached_app_user[key_search]
77
88
  if !token_cached.nil? and !token_cached.access_token.nil? and !token_cached.access_token.params.nil? and
78
- !token_cached.access_token.params['scope'].nil? and token_cached.access_token.params['scope'].include? scope and
79
- !token_cached.access_token.expires_at.nil? and token_cached.access_token.expires_at.is_a? Integer and
80
- is_expire(token_cached.access_token.expires_at) and !token_cached.access_token.token.nil?
89
+ !token_cached.access_token.params['scope'].nil? and !token_cached.access_token.expires_at.nil? and
90
+ token_cached.access_token.expires_at.is_a? Integer and is_valid(token_cached.access_token.expires_at) and
91
+ !token_cached.access_token.token.nil?
81
92
 
82
93
  return format_to_header(token_cached.access_token.token)
83
94
  end
@@ -107,16 +118,28 @@ module Wire4Auth
107
118
 
108
119
  begin
109
120
  client = OAuth2::Client.new(@client_id, @client_secret, :token_url => @environment.token_url)
110
- access_token = client.get_token({:grant_type => "client_credentials", :scope => scope})
111
- @token_cached_app.access_token = access_token
121
+ access_token = client.get_token({ :grant_type => "client_credentials", :scope => scope})
122
+
123
+ key_search = @client_id + scope
124
+ token_cached = @tokens_cached_app_user[key_search]
125
+ if token_cached.nil? and @tokens_cached_app_user.length + 1 > MAX_APP_USER_SIZE_CACHED
126
+ @tokens_cached_app_user.each_key do |key|
127
+ @tokens_cached_app_user.delete(key)
128
+ break
129
+ end
130
+ end
131
+
132
+ @tokens_cached_app_user[key_search] = Wire4Auth::CachedToken.new(@client_id, @client_secret, access_token)
112
133
 
113
134
  return format_to_header(access_token.token)
114
135
  rescue OAuth2::Error => e
115
136
  raise Wire4Client::ApiError.new(:code => e.code,
116
137
  :message => e.description)
117
138
  end
139
+
118
140
  end
119
141
 
142
+ #noinspection RubyInstanceMethodNamingConvention
120
143
  def regenerate_access_token_app_user(user_key, secret_key, scope = "spei_admin")
121
144
 
122
145
  begin
@@ -147,16 +170,17 @@ module Wire4Auth
147
170
  Wire4Client.configure do |config|
148
171
  # Configure OAuth2 access token for authorization
149
172
  config.host = @environment.service_url
173
+ config.base_path = @environment.base_path
150
174
  end
151
175
  end
152
176
 
153
177
  private
154
178
 
155
- def is_expire(expires_at)
179
+ def is_valid(expires_at)
156
180
 
157
181
  time = Time.at(expires_at)
158
182
  # Get current time using the time zone
159
- now = Time.now - 5 * 60 # minus 5 minutes
183
+ now = Time.now + 5 * 60 # plus 5 minutes
160
184
 
161
185
  time > now
162
186
  end
@@ -23,16 +23,19 @@ module Wire4Auth
23
23
 
24
24
  attr_reader :service_url
25
25
 
26
- def initialize(token_url, service_url)
26
+ attr_reader :base_path
27
+
28
+ def initialize(token_url, service_url, base_path)
27
29
  @token_url = token_url
28
30
  @service_url = service_url
31
+ @base_path = base_path
29
32
  end
30
33
 
31
- SANDBOX = new("https://sandbox-api.wire4.mx/token", "sandbox-api.wire4.mx")
34
+ SANDBOX = new('https://sandbox-api.wire4.mx/token', 'sandbox-api.wire4.mx', '/wire4/1.0.0')
32
35
 
33
- DEVELOPMENT = new('https://development-api.wire4.mx/token', 'development-api.wire4.mx')
36
+ DEVELOPMENT = new('https://development-api.wire4.mx/token', 'development-api.wire4.mx', '/wire4/1.0.0')
34
37
 
35
- PRODUCTION = new("https://api.wire4.mx/token", "api.wire4.mx")
38
+ PRODUCTION = new('https://api.wire4.mx/token', 'api.wire4.mx', '/wire4/1.0.0')
36
39
 
37
40
  class << self
38
41
  private :new
@@ -0,0 +1,222 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- encoding: utf-8 -*-
3
+
4
+ # COPYRIGHT © 2017. TCPIP.
5
+ # PATENT PENDING. ALL RIGHTS RESERVED.
6
+ # SPEI GATEWAY IS REGISTERED TRADEMARKS OF TCPIP.
7
+ #
8
+ # This software is confidential and proprietary information of TCPIP.
9
+ # You shall not disclose such Confidential Information and shall use it only
10
+ # in accordance with the company policy.
11
+
12
+ =begin
13
+ #Wire4Auth
14
+
15
+ Fecha de creación: 01 de september, 2020
16
+ author: Juan Mandujano
17
+ version: 1.0
18
+ =end
19
+
20
+ require 'test/unit'
21
+ require 'wire4_auth/auth/oauth_wire4'
22
+ require 'wire4_auth/webhook_verification_signature/utils_compute'
23
+ require 'wire4_client'
24
+
25
+ #noinspection RubyTooManyMethodsInspection
26
+ class Wire4ExamplesTest < Test::Unit::TestCase
27
+
28
+ CLIENT_ID = "6PqWzT6DgbEyLNu7d4YItJyuT2Ea"
29
+
30
+ CLIENT_SECRET = "00cRaDHZimyDENOJOQbA5psoVNoa"
31
+
32
+ USER_KEY = "9548042dccc4790a43c36d919fb677@develop.wire4.mx"
33
+
34
+ SECRET_KEY = "e9c24e4aa064a34bd6357400fab7c0"
35
+
36
+ SUBSCRIPTION = "73be6d4e-fa70-4732-8eab-a47b2b798a83"
37
+
38
+ def test_given_bad_credentials_should_raise_error
39
+ oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID,'CLIENT_SECRET',Wire4Auth::EnvironmentEnum::DEVELOPMENT)
40
+ oauth_wire4.config_default_api_client
41
+ puts "Calling token creation..."
42
+ assert_raise( Wire4Client::ApiError){oauth_wire4.obtain_access_token_app('general')}
43
+ end
44
+
45
+ def test_given_valid_credentials_should_return_token
46
+ oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID,CLIENT_SECRET,Wire4Auth::EnvironmentEnum::DEVELOPMENT)
47
+ oauth_wire4.config_default_api_client
48
+ puts "Calling token creation..."
49
+ token = oauth_wire4.obtain_access_token_app('general')
50
+ assert_not_nil(token, 'the token should not be nil')
51
+ end
52
+
53
+ def test_same_credentials_should_return_same_token
54
+ oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID,CLIENT_SECRET,Wire4Auth::EnvironmentEnum::DEVELOPMENT)
55
+ oauth_wire4.config_default_api_client
56
+ puts "Calling token creation..."
57
+ token = oauth_wire4.obtain_access_token_app('general')
58
+ second_token = oauth_wire4.obtain_access_token_app('general')
59
+ assert_equal(token, second_token, 'the tokens should be equals')
60
+ end
61
+
62
+ def test_different_scopes_for_same_user_should_return_different_tokens
63
+ oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID,CLIENT_SECRET,Wire4Auth::EnvironmentEnum::DEVELOPMENT)
64
+ oauth_wire4.config_default_api_client
65
+ puts "Calling token creation..."
66
+ general_token = oauth_wire4.obtain_access_token_app('general')
67
+ spei_admin_token = oauth_wire4.obtain_access_token_app('spei_admin')
68
+ spid_admin_token = oauth_wire4.obtain_access_token_app('spid_admin')
69
+ codi_general_token = oauth_wire4.obtain_access_token_app('codi_general')
70
+ codi_report_token = oauth_wire4.obtain_access_token_app('codi_report')
71
+ double_token = oauth_wire4.obtain_access_token_app('spei_admin codi_report')
72
+ assert_not_equal(general_token, spei_admin_token, 'the tokens should not be equals')
73
+ assert_not_equal(general_token, spid_admin_token, 'the tokens should not be equals')
74
+ assert_not_equal(general_token, codi_general_token, 'the tokens should not be equals')
75
+ assert_not_equal(general_token, codi_report_token, 'the tokens should not be equals')
76
+ assert_not_equal(general_token, double_token, 'the tokens should not be equals')
77
+ assert_not_equal(spei_admin_token, spid_admin_token, 'the tokens should not be equals')
78
+ assert_not_equal(codi_general_token, codi_report_token, 'the tokens should not be equals')
79
+ assert_not_equal(double_token, codi_report_token, 'the tokens should not be equals')
80
+ assert_not_equal(double_token, codi_general_token, 'the tokens should not be equals')
81
+ end
82
+
83
+ def test_given_many_tokens_for_same_user_should_keeps_in_cache
84
+ oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID,CLIENT_SECRET,Wire4Auth::EnvironmentEnum::DEVELOPMENT)
85
+ oauth_wire4.config_default_api_client
86
+ puts "Calling token creation..."
87
+ general_token = oauth_wire4.obtain_access_token_app('general')
88
+ spei_admin_token = oauth_wire4.obtain_access_token_app('spei_admin')
89
+ spid_admin_token = oauth_wire4.obtain_access_token_app('spid_admin')
90
+ codi_general_token = oauth_wire4.obtain_access_token_app('codi_general')
91
+ codi_report_token = oauth_wire4.obtain_access_token_app('codi_report')
92
+ double_token = oauth_wire4.obtain_access_token_app('spei_admin codi_report')
93
+ general_token_second = oauth_wire4.obtain_access_token_app('general')
94
+ spei_admin_token_second = oauth_wire4.obtain_access_token_app('spei_admin')
95
+ spid_admin_token_second = oauth_wire4.obtain_access_token_app('spid_admin')
96
+ codi_general_token_second = oauth_wire4.obtain_access_token_app('codi_general')
97
+ codi_report_token_second = oauth_wire4.obtain_access_token_app('codi_report')
98
+ double_token_second = oauth_wire4.obtain_access_token_app('spei_admin codi_report')
99
+ assert_equal(general_token, general_token_second, 'the tokens should be equals')
100
+ assert_equal(spei_admin_token, spei_admin_token_second, 'the tokens should be equals')
101
+ assert_equal(spid_admin_token, spid_admin_token_second, 'the tokens should be equals')
102
+ assert_equal(codi_general_token, codi_general_token_second, 'the tokens should be equals')
103
+ assert_equal(codi_report_token, codi_report_token_second, 'the tokens should be equals')
104
+ assert_equal(double_token, double_token_second, 'the tokens should be equals')
105
+ end
106
+
107
+ def test_when_regenerate_token_should_replace_old_token
108
+ oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID,CLIENT_SECRET,Wire4Auth::EnvironmentEnum::DEVELOPMENT)
109
+ oauth_wire4.config_default_api_client
110
+ puts "Calling token creation..."
111
+ general_token = oauth_wire4.obtain_access_token_app('general')
112
+ spei_admin_token = oauth_wire4.obtain_access_token_app('spei_admin')
113
+ spid_admin_token = oauth_wire4.obtain_access_token_app('spid_admin')
114
+ codi_general_token = oauth_wire4.obtain_access_token_app('codi_general')
115
+ codi_report_token = oauth_wire4.obtain_access_token_app('codi_report')
116
+ double_token = oauth_wire4.obtain_access_token_app('general codi_report')
117
+ puts "#{double_token}"
118
+ general_token_second = oauth_wire4.regenerate_access_token_app('general')
119
+ spei_admin_token_second = oauth_wire4.regenerate_access_token_app('spei_admin')
120
+ spid_admin_token_second = oauth_wire4.regenerate_access_token_app('spid_admin')
121
+ codi_general_token_second = oauth_wire4.regenerate_access_token_app('codi_general')
122
+ codi_report_token_second = oauth_wire4.regenerate_access_token_app('codi_report')
123
+ double_token_second = oauth_wire4.regenerate_access_token_app('general codi_report')
124
+ assert_not_equal(general_token, general_token_second, 'the tokens should not be equals')
125
+ assert_not_equal(spei_admin_token, spei_admin_token_second, 'the tokens should not be equals')
126
+ assert_not_equal(spid_admin_token, spid_admin_token_second, 'the tokens should not be equals')
127
+ assert_not_equal(codi_general_token, codi_general_token_second, 'the tokens should not be equals')
128
+ assert_not_equal(codi_report_token, codi_report_token_second, 'the tokens should not be equals')
129
+ assert_not_equal(double_token, double_token_second, 'the tokens should not be equals')
130
+ end
131
+
132
+ def test_given_bad_user_credentials_should_raise_error
133
+ oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID,CLIENT_SECRET,Wire4Auth::EnvironmentEnum::DEVELOPMENT)
134
+ oauth_wire4.config_default_api_client
135
+ puts "Calling token creation..."
136
+ assert_raise( Wire4Client::ApiError){oauth_wire4.obtain_access_token_app_user(USER_KEY, 'SECRET_KEY','spei_admin')}
137
+ end
138
+
139
+ def test_given_valid_user_credentials_should_return_token
140
+ oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID,CLIENT_SECRET,Wire4Auth::EnvironmentEnum::DEVELOPMENT)
141
+ oauth_wire4.config_default_api_client
142
+ puts "Calling token creation..."
143
+ token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spei_admin')
144
+ assert_not_nil(token, 'the token should not be nil')
145
+ end
146
+
147
+ def test_same_user_credentials_should_return_same_token
148
+ oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID,CLIENT_SECRET,Wire4Auth::EnvironmentEnum::DEVELOPMENT)
149
+ oauth_wire4.config_default_api_client
150
+ puts "Calling token creation..."
151
+ token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spei_admin')
152
+ second_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spei_admin')
153
+ assert_equal(token, second_token, 'the tokens should be equals')
154
+ end
155
+
156
+ def test_different_scopes_for_same_user_credentials_should_return_different_tokens
157
+ oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID,CLIENT_SECRET,Wire4Auth::EnvironmentEnum::DEVELOPMENT)
158
+ oauth_wire4.config_default_api_client
159
+ puts "Calling token creation..."
160
+
161
+ spei_admin_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spei_admin')
162
+ spid_admin_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spid_admin')
163
+ codi_general_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'codi_general')
164
+ codi_report_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'codi_report')
165
+ double_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spei_admin, codi_report')
166
+ assert_not_equal(spei_admin_token, spid_admin_token, 'the tokens should not be equals')
167
+ assert_not_equal(spei_admin_token, codi_general_token, 'the tokens should not be equals')
168
+ assert_not_equal(spei_admin_token, codi_report_token, 'the tokens should not be equals')
169
+ assert_not_equal(spei_admin_token, double_token, 'the tokens should not be equals')
170
+ assert_not_equal(spid_admin_token, double_token, 'the tokens should not be equals')
171
+ assert_not_equal(spid_admin_token, codi_report_token, 'the tokens should not be equals')
172
+ assert_not_equal(codi_general_token, codi_report_token, 'the tokens should not be equals')
173
+ assert_not_equal(double_token, codi_report_token, 'the tokens should not be equals')
174
+ assert_not_equal(double_token, codi_general_token, 'the tokens should not be equals')
175
+ end
176
+
177
+ def test_given_many_tokens_for_same_user_credentials_should_keeps_in_cache
178
+ oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID,CLIENT_SECRET,Wire4Auth::EnvironmentEnum::DEVELOPMENT)
179
+ oauth_wire4.config_default_api_client
180
+ puts "Calling token creation..."
181
+
182
+ spei_admin_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spei_admin')
183
+ spid_admin_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spid_admin')
184
+ codi_general_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'codi_general')
185
+ codi_report_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'codi_report')
186
+ double_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spei_admin, codi_report')
187
+ spei_admin_token_second = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spei_admin')
188
+ spid_admin_token_second = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spid_admin')
189
+ codi_general_token_second = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'codi_general')
190
+ codi_report_token_second = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'codi_report')
191
+ double_token_second = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spei_admin, codi_report')
192
+ assert_equal(spei_admin_token, spei_admin_token_second, 'the tokens should be equals')
193
+ assert_equal(spid_admin_token, spid_admin_token_second, 'the tokens should be equals')
194
+ assert_equal(codi_general_token, codi_general_token_second, 'the tokens should be equals')
195
+ assert_equal(codi_report_token, codi_report_token_second, 'the tokens should be equals')
196
+ assert_equal(double_token, double_token_second, 'the tokens should be equals')
197
+
198
+ end
199
+
200
+ def test_when_regenerate_user_token_should_replace_old_token
201
+ oauth_wire4 = Wire4Auth::OAuthWire4.new(CLIENT_ID,CLIENT_SECRET,Wire4Auth::EnvironmentEnum::DEVELOPMENT)
202
+ oauth_wire4.config_default_api_client
203
+ puts "Calling token creation..."
204
+
205
+ spei_admin_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spei_admin')
206
+ spid_admin_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spid_admin')
207
+ codi_general_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'codi_general')
208
+ codi_report_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'codi_report')
209
+ double_token = oauth_wire4.obtain_access_token_app_user(USER_KEY, SECRET_KEY,'spei_admin, codi_report')
210
+ spei_admin_token_second = oauth_wire4.regenerate_access_token_app_user(USER_KEY, SECRET_KEY,'spei_admin')
211
+ spid_admin_token_second = oauth_wire4.regenerate_access_token_app_user(USER_KEY, SECRET_KEY,'spid_admin')
212
+ codi_general_token_second = oauth_wire4.regenerate_access_token_app_user(USER_KEY, SECRET_KEY,'codi_general')
213
+ codi_report_token_second = oauth_wire4.regenerate_access_token_app_user(USER_KEY, SECRET_KEY,'codi_report')
214
+ double_token_second = oauth_wire4.regenerate_access_token_app_user(USER_KEY, SECRET_KEY,'spei_admin, codi_report')
215
+ assert_not_equal(spei_admin_token, spei_admin_token_second, 'the tokens should not be equals')
216
+ assert_not_equal(spid_admin_token, spid_admin_token_second, 'the tokens should not be equals')
217
+ assert_not_equal(codi_general_token, codi_general_token_second, 'the tokens should not be equals')
218
+ assert_not_equal(codi_report_token, codi_report_token_second, 'the tokens should not be equals')
219
+ assert_not_equal(double_token, double_token_second, 'the tokens should not be equals')
220
+ end
221
+
222
+ end
@@ -15,5 +15,5 @@ version: 1.0
15
15
  =end
16
16
 
17
17
  module Wire4Auth
18
- VERSION = '1.0.0'
18
+ VERSION = '1.1.1'
19
19
  end
data/wire4_auth.gemspec CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  Fecha de creación: 11 de diciembre, 2019
15
15
  author: Saintiago García
16
- version: 1.0
16
+ version: 1.1.0
17
17
  =end
18
18
 
19
19
  $:.push File.expand_path("../lib", __FILE__)
@@ -31,10 +31,10 @@ Gem::Specification.new do |s|
31
31
  s.license = "Unlicense"
32
32
  s.required_ruby_version = ">= 1.9"
33
33
 
34
- s.add_runtime_dependency 'oauth2', '~> 1.4', '>= 1.4.2'
35
- s.add_runtime_dependency 'wire4_client', '~> 1.0.0', '>= 1.0.0'
34
+ s.add_runtime_dependency 'oauth2', '~> 1.4', '>= 1.4.3'
35
+ s.add_runtime_dependency 'wire4_client', '~> 1.0', '>= 1.1.1'
36
36
 
37
- s.add_development_dependency 'test-unit', '~> 3.3', '>= 3.3.0'
37
+ s.add_development_dependency 'test-unit', '~> 3.3', '>= 3.3.5'
38
38
 
39
39
  s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
40
40
  s.executables = []
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wire4_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wire4
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-30 00:00:00.000000000 Z
11
+ date: 2021-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '1.4'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.4.2
22
+ version: 1.4.3
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,47 +29,47 @@ dependencies:
29
29
  version: '1.4'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.4.2
32
+ version: 1.4.3
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: wire4_client
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: 1.0.0
40
37
  - - "~>"
41
38
  - !ruby/object:Gem::Version
42
- version: 1.0.0
39
+ version: '1.0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.1.1
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: 1.0.0
50
47
  - - "~>"
51
48
  - !ruby/object:Gem::Version
52
- version: 1.0.0
49
+ version: '1.0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.1.1
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: test-unit
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: 3.3.0
60
57
  - - "~>"
61
58
  - !ruby/object:Gem::Version
62
59
  version: '3.3'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 3.3.5
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: 3.3.0
70
67
  - - "~>"
71
68
  - !ruby/object:Gem::Version
72
69
  version: '3.3'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 3.3.5
73
73
  description: Herramienta para autenticacion de la API de Wire4
74
74
  email:
75
75
  - ''
@@ -78,12 +78,11 @@ extensions: []
78
78
  extra_rdoc_files: []
79
79
  files:
80
80
  - Gemfile
81
- - Gemfile.lock
82
81
  - lib/wire4_auth.rb
83
82
  - lib/wire4_auth/auth/oauth_wire4.rb
84
83
  - lib/wire4_auth/core/cached_token.rb
85
84
  - lib/wire4_auth/core/environment_enum.rb
86
- - lib/wire4_auth/testing.rb
85
+ - lib/wire4_auth/tokens_test.rb
87
86
  - lib/wire4_auth/version.rb
88
87
  - lib/wire4_auth/webhook_verification_signature/utils_compute.rb
89
88
  - wire4_auth.gemspec