wire4_auth 1.0.1 → 1.1.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: 7cc203bd9934f2eba3455f6b805df2456e7fc2d3fa30b1bb918e4cb9801bd68e
4
- data.tar.gz: dfa71f4eaf55806c5af5138ab04fce185c19687b8e4d08af6272473538b85dc2
3
+ metadata.gz: 6c2b54a029bbe4fa44c8aea1cb9e6f9b3c375d3ecd645929eb886d511f9435ab
4
+ data.tar.gz: 85e913c5869d7365d12033473d62a0ee0f6c6c92fd6aa167dc59382a92caa804
5
5
  SHA512:
6
- metadata.gz: 554aa51aff78048a0e0cd7856e8aeebcca0d74278d18e57ba057e641d4e863255dc39530572f6552401c07e5fdaa5af56ac93c6f6fcb46b9075a6032d33cae8d
7
- data.tar.gz: b11a465f5b368f48a1e5e197212070fd89dda17888e17f2135ed35b4167d4c9d44cd2157c28bf6bf9c4e544292a3dcd84c89007a9c6680045077ec27cb4c95dc
6
+ metadata.gz: e28aa7372ac7173ba6213f15effdde18b205a6719b5b23734b7b82663c201277f4fae8ab5a6a562eb211e4456274277bc5ea8b1770401e2f51edda515d540266
7
+ data.tar.gz: fbe1b10aae081c27b336f08a434263c9d019834b28b891d63190f7f8f3a1383a878f54014bf0def7bdd2c7c4e9179826e33ec11ab7f854ccfb4f425e9ada6afc
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'
6
+ gem 'oauth2', '~> 1.4.3'
7
+ gem 'wire4_client', '~> 1.1.2'
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.1'
18
+ VERSION = '1.1.2'
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'
34
+ s.add_runtime_dependency 'oauth2', '~> 1.4', '>= 1.4.3'
35
+ s.add_runtime_dependency 'wire4_client', '~> 1.0', '>= 1.1.2'
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.1
4
+ version: 1.1.2
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-16 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
- - - ">="
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '1.0'
40
- - - "~>"
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 1.0.0
42
+ version: 1.1.2
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ">="
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
49
  version: '1.0'
50
- - - "~>"
50
+ - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 1.0.0
52
+ version: 1.1.2
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