omniauth-swedbank 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -15,3 +15,5 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .ruby-gemset
19
+ .ruby-version
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.2"
4
+ - "1.9.3"
5
+ script: bundle exec rspec
data/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  TODO: Write a gem description
4
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/omniauth-swedbank.png)](http://badge.fury.io/rb/omniauth-swedbank)
6
+ [![Build Status](https://travis-ci.org/kirsis/omniauth-swedbank.png?branch=master)](https://travis-ci.org/kirsis/omniauth-swedbank)
7
+
5
8
  ## Installation
6
9
 
7
10
  Add this line to your application's Gemfile:
@@ -1 +1,4 @@
1
- require 'omniauth/swedbank'
1
+ require 'omniauth/swedbank'
2
+ require 'i18n'
3
+
4
+ I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'omniauth', 'locales', '*.yml')]
@@ -0,0 +1,5 @@
1
+ en:
2
+ omniauth:
3
+ swedbank:
4
+ please_wait: Please wait...
5
+ click_here_if_not_redirected: Click here, if not redirected automatically
@@ -0,0 +1,5 @@
1
+ lv:
2
+ omniauth:
3
+ swedbank:
4
+ please_wait: Lūdzu uzgaidiet...
5
+ click_here_if_not_redirected: Spiediet šeit, ja pāradresācija nenotiek automātiski
@@ -1,16 +1,23 @@
1
1
  require 'omniauth'
2
2
  require 'base64'
3
3
 
4
+ class String
5
+ def prepend_length
6
+ # prepend length to string in 0xx format
7
+ len = self.to_s.length
8
+ self.dup.to_s.force_encoding("ascii").prepend(len.to_s.rjust(3, '0'))
9
+ end
10
+ end
11
+
4
12
  module OmniAuth
5
13
  module Strategies
6
14
  class Swedbank
7
15
  # TODO add support for overriding the VK_LANG parameter
8
- # TODO i18n for all texts
9
16
 
10
17
  include OmniAuth::Strategy
11
18
 
12
- AUTH_SERVICE_ID = :"4002"
13
- AUTH_SERVICE_VERSION = :"008" # This value must not be used as a number, so as to not lose the padding
19
+ AUTH_SERVICE_ID = "4002"
20
+ AUTH_SERVICE_VERSION = "008" # This value must not be used as a number, so as to not lose the padding
14
21
  # Padding is important when generating the VK_MAC value
15
22
 
16
23
  args [:private_key_file, :public_key_file, :snd_id, :rec_id]
@@ -32,30 +39,28 @@ module OmniAuth
32
39
  @nonce = ((full_host.gsub(/[\:\/]/, "X") + SecureRandom.uuid.gsub("-", "")).rjust 50, " ")[-50, 50]
33
40
  end
34
41
 
35
- def append_value_to_signature(value, signature = "")
36
- signature << "#{value.to_s.bytesize.to_s.rjust(3, '0')}#{value}"
37
- end
38
-
39
42
  def signature_input
40
- sig_str = append_value_to_signature(AUTH_SERVICE_ID) # VK_SERVICE
41
- append_value_to_signature(AUTH_SERVICE_VERSION, sig_str) # VK_VERSION
42
- append_value_to_signature(options.snd_id, sig_str) # VK_SND_ID
43
- append_value_to_signature(options.rec_id, sig_str) # VK_REC_ID
44
- append_value_to_signature(nonce, sig_str) # VK_NONCE
45
- append_value_to_signature(callback_url, sig_str) # VK_RETURN
43
+ [
44
+ AUTH_SERVICE_ID, # VK_SERVICE
45
+ AUTH_SERVICE_VERSION, # VK_SERVICE
46
+ options.snd_id, # VK_SND_ID
47
+ options.rec_id, # VK_REC_ID
48
+ nonce, # VK_NONCE
49
+ callback_url # VK_RETURN
50
+ ].map(&:prepend_length).join
46
51
  end
47
52
 
48
- def signature (priv_key)
53
+ def signature(priv_key)
49
54
  Base64.encode64(priv_key.sign(OpenSSL::Digest::SHA1.new, signature_input))
50
55
  end
51
56
 
52
57
  uid do
53
- request.params[:VK_INFO.to_s].match(/ISIK:(\d{6}\-\d{5})/)[1]
58
+ request.params["VK_INFO"].match(/ISIK:(\d{6}\-\d{5})/)[1]
54
59
  end
55
60
 
56
61
  info do
57
62
  {
58
- :full_name => request.params[:VK_INFO.to_s].match(/NIMI:(.+)/)[1]
63
+ :full_name => request.params["VK_INFO"].match(/NIMI:(.+)/)[1]
59
64
  }
60
65
  end
61
66
 
@@ -66,26 +71,28 @@ module OmniAuth
66
71
  return fail!(:public_key_load_err, e)
67
72
  end
68
73
 
69
- if request.params[:VK_SERVICE.to_s] != "3003"
74
+ if request.params["VK_SERVICE"] != "3003"
70
75
  return fail!(:unsupported_response_service_err)
71
76
  end
72
77
 
73
- if request.params[:VK_VERSION.to_s] != "008"
78
+ if request.params["VK_VERSION"] != "008"
74
79
  return fail!(:unsupported_response_version_err)
75
80
  end
76
81
 
77
- if request.params[:VK_ENCODING.to_s] != "UTF-8"
82
+ if request.params["VK_ENCODING"] != "UTF-8"
78
83
  return fail!(:unsupported_response_encoding_err)
79
84
  end
80
85
 
81
- sig_str = append_value_to_signature(request.params[:VK_SERVICE.to_s])
82
- append_value_to_signature(request.params[:VK_VERSION.to_s], sig_str)
83
- append_value_to_signature(request.params[:VK_SND_ID.to_s], sig_str)
84
- append_value_to_signature(request.params[:VK_REC_ID.to_s], sig_str)
85
- append_value_to_signature(request.params[:VK_NONCE.to_s], sig_str)
86
- append_value_to_signature(request.params[:VK_INFO.to_s], sig_str)
86
+ sig_str = [
87
+ request.params["VK_SERVICE"],
88
+ request.params["VK_VERSION"],
89
+ request.params["VK_SND_ID"],
90
+ request.params["VK_REC_ID"],
91
+ request.params["VK_NONCE"],
92
+ request.params["VK_INFO"]
93
+ ].map(&:prepend_length).join
87
94
 
88
- raw_signature = Base64.decode64(request.params[:VK_MAC.to_s])
95
+ raw_signature = Base64.decode64(request.params["VK_MAC"])
89
96
 
90
97
  if !pub_key.verify(OpenSSL::Digest::SHA1.new, raw_signature, sig_str)
91
98
  return fail!(:invalid_response_signature_err)
@@ -104,22 +111,25 @@ module OmniAuth
104
111
  end
105
112
 
106
113
  OmniAuth.config.form_css = nil
107
- form = OmniAuth::Form.new(:title => "Please wait ...", :url => options.site)
114
+ form = OmniAuth::Form.new(:title => I18n.t("omniauth.swedbank.please_wait"), :url => options.site)
108
115
 
109
- form.html "<input type=\"hidden\" name=\"VK_SERVICE\" value=\"#{AUTH_SERVICE_ID}\" />"
110
- form.html "<input type=\"hidden\" name=\"VK_VERSION\" value=\"#{AUTH_SERVICE_VERSION}\" />"
111
- form.html "<input type=\"hidden\" name=\"VK_SND_ID\" value=\"#{options.snd_id}\" />"
112
- form.html "<input type=\"hidden\" name=\"VK_REC_ID\" value=\"#{options.rec_id}\" />"
113
- form.html "<input type=\"hidden\" name=\"VK_NONCE\" value=\"#{nonce}\" />"
114
- form.html "<input type=\"hidden\" name=\"VK_RETURN\" value=\"#{callback_url}\" />"
115
- form.html "<input type=\"hidden\" name=\"VK_LANG\" value=\"LAT\" />"
116
- form.html "<input type=\"hidden\" name=\"VK_MAC\" value=\"#{signature priv_key}\" />"
116
+ {
117
+ "VK_SERVICE" => AUTH_SERVICE_ID,
118
+ "VK_VERSION" => AUTH_SERVICE_VERSION,
119
+ "VK_SND_ID" => options.snd_id,
120
+ "VK_REC_ID" => options.rec_id,
121
+ "VK_NONCE" => nonce,
122
+ "VK_RETURN" => callback_url,
123
+ "VK_LANG" => "LAT",
124
+ "VK_MAC" => signature(priv_key)
125
+ }.each do |name, val|
126
+ form.html "<input type=\"hidden\" name=\"#{name}\" value=\"#{val}\" />"
127
+ end
117
128
 
118
- form.button "Click here if not redirected automatically ..."
129
+ form.button I18n.t("omniauth.swedbank.click_here_if_not_redirected")
119
130
 
120
131
  form.instance_variable_set("@html",
121
132
  form.to_html.gsub("</form>", "</form><script type=\"text/javascript\">document.forms[0].submit();</script>"))
122
- #puts form.to_html
123
133
  form.to_response
124
134
  rescue => e
125
135
  fail!(:unknown_request_err, e)
@@ -1,2 +1,2 @@
1
1
  require 'omniauth/swedbank/version'
2
- require 'omniauth/strategies/swedbank'
2
+ require 'omniauth/strategies/swedbank'
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Swedbank
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
@@ -6,8 +6,8 @@ require 'omniauth/swedbank/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "omniauth-swedbank"
8
8
  spec.version = Omniauth::Swedbank::VERSION
9
- spec.authors = ["Jānis Kiršteins"]
10
- spec.email = ["janis@montadigital.com"]
9
+ spec.authors = ["Jānis Kiršteins", "Kristaps Ērglis"]
10
+ spec.email = ["janis@montadigital.com", "kristaps.erglis@gmail.com" ]
11
11
  spec.description = %q{OmniAuth strategy for Swedbank Banklink}
12
12
  spec.summary = %q{OmniAuth strategy for Swedbank Banklink}
13
13
  spec.homepage = ""
@@ -23,4 +23,6 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency 'rspec', '~> 2.7'
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
25
25
  spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "i18n"
27
+
26
28
  end
@@ -7,7 +7,7 @@ describe OmniAuth::Strategies::Swedbank do
7
7
 
8
8
  let(:app){ Rack::Builder.new do |b|
9
9
  b.use Rack::Session::Cookie, {:secret => "abc123"}
10
- b.use(OmniAuth::Strategies::Swedbank, PRIVATE_KEY_FILE, PUBLIC_KEY_FILE, :"MY_SND_ID", :"MY_REC_ID")
10
+ b.use(OmniAuth::Strategies::Swedbank, PRIVATE_KEY_FILE, PUBLIC_KEY_FILE, "MY_SND_ID", "MY_REC_ID")
11
11
  b.run lambda{|env| [404, {}, ['Not Found']]}
12
12
  end.to_app }
13
13
 
@@ -18,11 +18,11 @@ describe OmniAuth::Strategies::Swedbank do
18
18
 
19
19
  context "request phase" do
20
20
  EXPECTED_VALUES = {
21
- :VK_SERVICE => :"4002",
22
- :VK_VERSION => :"008",
23
- :VK_SND_ID => :MY_SND_ID,
24
- :VK_REC_ID => :MY_REC_ID,
25
- :VK_RETURN => :"http://example.org/auth/swedbank/callback"
21
+ "VK_SERVICE" => "4002",
22
+ "VK_VERSION" => "008",
23
+ "VK_SND_ID" => "MY_SND_ID",
24
+ "VK_REC_ID" => "MY_REC_ID",
25
+ "VK_RETURN" => "http://example.org/auth/swedbank/callback"
26
26
  }
27
27
 
28
28
  before(:each){ get '/auth/swedbank' }
@@ -54,7 +54,7 @@ describe OmniAuth::Strategies::Swedbank do
54
54
  "009MY_SND_ID" + # VK_SND_ID
55
55
  "009MY_REC_ID" + # VK_REC_ID
56
56
  "050" + last_response_nonce + # VK_NONCE
57
- "041#{EXPECTED_VALUES[:VK_RETURN]}" # V_RETURN
57
+ "041#{EXPECTED_VALUES["VK_RETURN"]}" # V_RETURN
58
58
 
59
59
  expected_mac = Base64.encode64(private_key.sign(OpenSSL::Digest::SHA1.new, sig_str))
60
60
  expect(last_response_mac).to eq(expected_mac)
@@ -73,7 +73,7 @@ describe OmniAuth::Strategies::Swedbank do
73
73
  context "with custom options" do
74
74
  let(:app){ Rack::Builder.new do |b|
75
75
  b.use Rack::Session::Cookie, {:secret => "abc123"}
76
- b.use(OmniAuth::Strategies::Swedbank, PRIVATE_KEY_FILE, PUBLIC_KEY_FILE, :"MY_SND_ID", :"MY_REC_ID",
76
+ b.use(OmniAuth::Strategies::Swedbank, PRIVATE_KEY_FILE, PUBLIC_KEY_FILE, "MY_SND_ID", "MY_REC_ID",
77
77
  :site => "https://test.lv/banklink")
78
78
  b.run lambda{|env| [404, {}, ['Not Found']]}
79
79
  end.to_app }
@@ -86,7 +86,7 @@ describe OmniAuth::Strategies::Swedbank do
86
86
  context "with non-existant private key files" do
87
87
  let(:app){ Rack::Builder.new do |b|
88
88
  b.use Rack::Session::Cookie, {:secret => "abc123"}
89
- b.use(OmniAuth::Strategies::Swedbank, "missing-private-key-file.pem", PUBLIC_KEY_FILE, :"MY_SND_ID", :"MY_REC_ID")
89
+ b.use(OmniAuth::Strategies::Swedbank, "missing-private-key-file.pem", PUBLIC_KEY_FILE, "MY_SND_ID", "MY_REC_ID")
90
90
  b.run lambda{|env| [404, {}, ['Not Found']]}
91
91
  end.to_app }
92
92
 
@@ -103,15 +103,15 @@ describe OmniAuth::Strategies::Swedbank do
103
103
  context "with valid response" do
104
104
  before do
105
105
  post :'/auth/swedbank/callback',
106
- :VK_SERVICE => :'3003',
107
- :VK_VERSION => :'008',
108
- :VK_SND_ID => :"HP",
109
- :VK_REC_ID => :"MY_REC_ID",
110
- :VK_NONCE => :"pXXXlocalhostX3000b41292810c0345a7b3770b1c807bed7a",
111
- :VK_INFO => :'ISIK:123456-12345;NIMI:Example User',
112
- :VK_MAC => :"cmXyp2My7P9pTgrzqJeg7qH+NPCuyaiGNpQIrcCr6S44w0bH+Ao4WDViqytaPH2vENooVPXDSgOcBqHTg44gJ9FlrhI5StiouHVhjpCcWg+h/ERcyc8w58PjsEmdsd4BIpaGXNyhvcIKdWfNwYA1UCIrmFsPAPWfVeorNxp81E7pvY4p4zsqMF80YZ7/RdOpjrtuXJ4nYJ7d+2fXJKKmUlqArCc786DJdb/z8wVDSNA9BZxnf8EE6s//p9gzqLPAg/T9Xp/2024n2JtC6kwsWF614bn64LEZz5c8owZth6FV+2fjnzHxOiifOe+jc9SRstCLITK6Y0j+6n8auiEZ5g==",
113
- :VK_ENCODING => :'UTF-8',
114
- :VK_LANG => :'LAT'
106
+ "VK_SERVICE" => '3003',
107
+ "VK_VERSION" => '008',
108
+ "VK_SND_ID" => "HP",
109
+ "VK_REC_ID" => "MY_REC_ID",
110
+ "VK_NONCE" => "pXXXlocalhostX3000b41292810c0345a7b3770b1c807bed7a",
111
+ "VK_INFO" => 'ISIK:123456-12345;NIMI:Example User',
112
+ "VK_MAC" => "cmXyp2My7P9pTgrzqJeg7qH+NPCuyaiGNpQIrcCr6S44w0bH+Ao4WDViqytaPH2vENooVPXDSgOcBqHTg44gJ9FlrhI5StiouHVhjpCcWg+h/ERcyc8w58PjsEmdsd4BIpaGXNyhvcIKdWfNwYA1UCIrmFsPAPWfVeorNxp81E7pvY4p4zsqMF80YZ7/RdOpjrtuXJ4nYJ7d+2fXJKKmUlqArCc786DJdb/z8wVDSNA9BZxnf8EE6s//p9gzqLPAg/T9Xp/2024n2JtC6kwsWF614bn64LEZz5c8owZth6FV+2fjnzHxOiifOe+jc9SRstCLITK6Y0j+6n8auiEZ5g==",
113
+ "VK_ENCODING" => 'UTF-8',
114
+ "VK_LANG" => 'LAT'
115
115
  end
116
116
 
117
117
  it "sets the correct uid value in the auth hash" do
@@ -141,15 +141,15 @@ describe OmniAuth::Strategies::Swedbank do
141
141
 
142
142
  it "detects invalid signature" do
143
143
  post :'/auth/swedbank/callback',
144
- :VK_SERVICE => :'3003',
145
- :VK_VERSION => :'008',
146
- :VK_SND_ID => :"HP",
147
- :VK_REC_ID => :"MY_REC_ID",
148
- :VK_NONCE => :'pXXXlocalhostX3000df346e9e453d43cd9c3c4076030d9e54',
149
- :VK_INFO => :'ISIK:123456-12345;NIMI:Example User',
150
- :VK_MAC => "invalid signature",
151
- :VK_ENCODING => :'UTF-8',
152
- :VK_LANG => :'LAT'
144
+ "VK_SERVICE" => '3003',
145
+ "VK_VERSION" => '008',
146
+ "VK_SND_ID" => "HP",
147
+ "VK_REC_ID" => "MY_REC_ID",
148
+ "VK_NONCE" => 'pXXXlocalhostX3000df346e9e453d43cd9c3c4076030d9e54',
149
+ "VK_INFO" => 'ISIK:123456-12345;NIMI:Example User',
150
+ "VK_MAC" => "invalid signature",
151
+ "VK_ENCODING" => 'UTF-8',
152
+ "VK_LANG" => 'LAT'
153
153
 
154
154
  expect(last_response.status).to eq(302)
155
155
  expect(last_response.headers["Location"]).to eq("/auth/failure?message=invalid_response_signature_err&strategy=swedbank")
@@ -157,15 +157,15 @@ describe OmniAuth::Strategies::Swedbank do
157
157
 
158
158
  it "detects unsupported VK_SERVICE values" do
159
159
  post :'/auth/swedbank/callback',
160
- :VK_SERVICE => :'3004',
161
- :VK_VERSION => :'008',
162
- :VK_SND_ID => :"HP",
163
- :VK_REC_ID => :"MY_REC_ID",
164
- :VK_NONCE => :'pXXXlocalhostX3000df2afdbd66ee4c3a998b72cfd3d7d131',
165
- :VK_INFO => :'ISIK:123456-12345;NIMI:Example User',
166
- :VK_MAC => :"tzGu5AxwaEMwAjkY8zh796NQ45QSEshuFiT0VnOdDN3gZPYlAcmm5jPs+j17U1rCKvz6tdKn9I8u+OUcV95+1Sa34dZ/09KrUgwDrOej/djJZ2lg5MgGLAftDsRomcCCuBppQvjdzhCvNeA2OAWPbl7Enn6HVjvb3esJY6D80bYIPm48DHDhhHbdcSwHubFeizyw9syviFsN3xVkhr5YS7W1/owXh/jeHSf8cqLVSzRyShU/JnJfevNsXDpSHbphA5Q4n5q5y0EcuA6/wW2qc2o5nKQjDDhZgxkWYKz6YpVj8zC2x/LXUkmJ+r1K0Slw2lhwEcP2tgIdThkAaT8MYQ==",
167
- :VK_ENCODING => :'UTF-8',
168
- :VK_LANG => :'LAT'
160
+ "VK_SERVICE" => '3004',
161
+ "VK_VERSION" => '008',
162
+ "VK_SND_ID" => "HP",
163
+ "VK_REC_ID" => "MY_REC_ID",
164
+ "VK_NONCE" => 'pXXXlocalhostX3000df2afdbd66ee4c3a998b72cfd3d7d131',
165
+ "VK_INFO" => 'ISIK:123456-12345;NIMI:Example User',
166
+ "VK_MAC" => "tzGu5AxwaEMwAjkY8zh796NQ45QSEshuFiT0VnOdDN3gZPYlAcmm5jPs+j17U1rCKvz6tdKn9I8u+OUcV95+1Sa34dZ/09KrUgwDrOej/djJZ2lg5MgGLAftDsRomcCCuBppQvjdzhCvNeA2OAWPbl7Enn6HVjvb3esJY6D80bYIPm48DHDhhHbdcSwHubFeizyw9syviFsN3xVkhr5YS7W1/owXh/jeHSf8cqLVSzRyShU/JnJfevNsXDpSHbphA5Q4n5q5y0EcuA6/wW2qc2o5nKQjDDhZgxkWYKz6YpVj8zC2x/LXUkmJ+r1K0Slw2lhwEcP2tgIdThkAaT8MYQ==",
167
+ "VK_ENCODING" => 'UTF-8',
168
+ "VK_LANG" => 'LAT'
169
169
 
170
170
  expect(last_response.status).to eq(302)
171
171
  expect(last_response.headers["Location"]).to eq("/auth/failure?message=unsupported_response_service_err&strategy=swedbank")
@@ -173,15 +173,15 @@ describe OmniAuth::Strategies::Swedbank do
173
173
 
174
174
  it "detects unsupported VK_VERSION values" do
175
175
  post :'/auth/swedbank/callback',
176
- :VK_SERVICE => :'3003',
177
- :VK_VERSION => :'009',
178
- :VK_SND_ID => :"HP",
179
- :VK_REC_ID => :"MY_REC_ID",
180
- :VK_NONCE => :'pXXXlocalhostX300023f78258d685424584f4e859b5d480f5',
181
- :VK_INFO => :'ISIK:123456-12345;NIMI:Example User',
182
- :VK_MAC => :"0KACnfCZZW2pQnFGttOXMrQRnmYQj45SwqIa5SbKhybJlP1GaXaoa5VYa+xGAnizx+YKbYQsXchXbeNIlQNrQ8/gedByzJtNFI4s4VIaU0tp7P83BjbzYfSMwvIImZvlFyVPgey8Va06fPGi+jdoUp7Dr8vwf6eAzxQhyVjEEYVR+axkAJP9+driMqTKQaxMlctWnivxf8stjI1ElmcdurndLbVnmHLTw6AichmzqUfvfXE3wh4XCVZtD+7VBPvbn4eKXif61cNfkOO/+nNap1buW8RLQirL7Eis//MmWoGSW8H5605DAAK9Ui7CNoB279Ww05pY4wsP7KZdiJ4WCA==",
183
- :VK_ENCODING => :'UTF-8',
184
- :VK_LANG => :'LAT'
176
+ "VK_SERVICE" => '3003',
177
+ "VK_VERSION" => '009',
178
+ "VK_SND_ID" => "HP",
179
+ "VK_REC_ID" => "MY_REC_ID",
180
+ "VK_NONCE" => 'pXXXlocalhostX300023f78258d685424584f4e859b5d480f5',
181
+ "VK_INFO" => 'ISIK:123456-12345;NIMI:Example User',
182
+ "VK_MAC" => "0KACnfCZZW2pQnFGttOXMrQRnmYQj45SwqIa5SbKhybJlP1GaXaoa5VYa+xGAnizx+YKbYQsXchXbeNIlQNrQ8/gedByzJtNFI4s4VIaU0tp7P83BjbzYfSMwvIImZvlFyVPgey8Va06fPGi+jdoUp7Dr8vwf6eAzxQhyVjEEYVR+axkAJP9+driMqTKQaxMlctWnivxf8stjI1ElmcdurndLbVnmHLTw6AichmzqUfvfXE3wh4XCVZtD+7VBPvbn4eKXif61cNfkOO/+nNap1buW8RLQirL7Eis//MmWoGSW8H5605DAAK9Ui7CNoB279Ww05pY4wsP7KZdiJ4WCA==",
183
+ "VK_ENCODING" => 'UTF-8',
184
+ "VK_LANG" => 'LAT'
185
185
 
186
186
  expect(last_response.status).to eq(302)
187
187
  expect(last_response.headers["Location"]).to eq("/auth/failure?message=unsupported_response_version_err&strategy=swedbank")
@@ -189,15 +189,15 @@ describe OmniAuth::Strategies::Swedbank do
189
189
 
190
190
  it "detects unsupported VK_ENCODING values" do
191
191
  post :'/auth/swedbank/callback',
192
- :VK_SERVICE => :'3003',
193
- :VK_VERSION => :'008',
194
- :VK_SND_ID => :"HP",
195
- :VK_REC_ID => :"MY_REC_ID",
196
- :VK_NONCE => :"pXXXlocalhostX3000b41292810c0345a7b3770b1c807bed7a",
197
- :VK_INFO => :'ISIK:123456-12345;NIMI:Example User',
198
- :VK_MAC => :"cmXyp2My7P9pTgrzqJeg7qH+NPCuyaiGNpQIrcCr6S44w0bH+Ao4WDViqytaPH2vENooVPXDSgOcBqHTg44gJ9FlrhI5StiouHVhjpCcWg+h/ERcyc8w58PjsEmdsd4BIpaGXNyhvcIKdWfNwYA1UCIrmFsPAPWfVeorNxp81E7pvY4p4zsqMF80YZ7/RdOpjrtuXJ4nYJ7d+2fXJKKmUlqArCc786DJdb/z8wVDSNA9BZxnf8EE6s//p9gzqLPAg/T9Xp/2024n2JtC6kwsWF614bn64LEZz5c8owZth6FV+2fjnzHxOiifOe+jc9SRstCLITK6Y0j+6n8auiEZ5g==",
199
- :VK_ENCODING => :'ASCII',
200
- :VK_LANG => :'LAT'
192
+ "VK_SERVICE" => '3003',
193
+ "VK_VERSION" => '008',
194
+ "VK_SND_ID" => "HP",
195
+ "VK_REC_ID" => "MY_REC_ID",
196
+ "VK_NONCE" => "pXXXlocalhostX3000b41292810c0345a7b3770b1c807bed7a",
197
+ "VK_INFO" => 'ISIK:123456-12345;NIMI:Example User',
198
+ "VK_MAC" => "cmXyp2My7P9pTgrzqJeg7qH+NPCuyaiGNpQIrcCr6S44w0bH+Ao4WDViqytaPH2vENooVPXDSgOcBqHTg44gJ9FlrhI5StiouHVhjpCcWg+h/ERcyc8w58PjsEmdsd4BIpaGXNyhvcIKdWfNwYA1UCIrmFsPAPWfVeorNxp81E7pvY4p4zsqMF80YZ7/RdOpjrtuXJ4nYJ7d+2fXJKKmUlqArCc786DJdb/z8wVDSNA9BZxnf8EE6s//p9gzqLPAg/T9Xp/2024n2JtC6kwsWF614bn64LEZz5c8owZth6FV+2fjnzHxOiifOe+jc9SRstCLITK6Y0j+6n8auiEZ5g==",
199
+ "VK_ENCODING" => 'ASCII',
200
+ "VK_LANG" => 'LAT'
201
201
 
202
202
  expect(last_response.status).to eq(302)
203
203
  expect(last_response.headers["Location"]).to eq("/auth/failure?message=unsupported_response_encoding_err&strategy=swedbank")
data/spec/spec_helper.rb CHANGED
@@ -14,4 +14,6 @@ RSpec.configure do |config|
14
14
  config.expect_with :rspec do |c|
15
15
  c.syntax = :expect
16
16
  end
17
- end
17
+ end
18
+
19
+ I18n.enforce_available_locales = false
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-swedbank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jānis Kiršteins
9
+ - Kristaps Ērglis
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-04-30 00:00:00.000000000 Z
13
+ date: 2014-02-04 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: omniauth
@@ -91,14 +92,32 @@ dependencies:
91
92
  - - ! '>='
92
93
  - !ruby/object:Gem::Version
93
94
  version: '0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: i18n
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
94
111
  description: OmniAuth strategy for Swedbank Banklink
95
112
  email:
96
113
  - janis@montadigital.com
114
+ - kristaps.erglis@gmail.com
97
115
  executables: []
98
116
  extensions: []
99
117
  extra_rdoc_files: []
100
118
  files:
101
119
  - .gitignore
120
+ - .travis.yml
102
121
  - Gemfile
103
122
  - LICENSE.txt
104
123
  - README.md
@@ -106,6 +125,8 @@ files:
106
125
  - certs/request.private.pem
107
126
  - certs/response.public.pem
108
127
  - lib/omniauth-swedbank.rb
128
+ - lib/omniauth/locales/omniauth.en.yml
129
+ - lib/omniauth/locales/omniauth.lv.yml
109
130
  - lib/omniauth/strategies/swedbank.rb
110
131
  - lib/omniauth/swedbank.rb
111
132
  - lib/omniauth/swedbank/version.rb
@@ -127,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
148
  version: '0'
128
149
  segments:
129
150
  - 0
130
- hash: 663600904428449775
151
+ hash: 85448241469410673
131
152
  required_rubygems_version: !ruby/object:Gem::Requirement
132
153
  none: false
133
154
  requirements:
@@ -136,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
157
  version: '0'
137
158
  segments:
138
159
  - 0
139
- hash: 663600904428449775
160
+ hash: 85448241469410673
140
161
  requirements: []
141
162
  rubyforge_project:
142
163
  rubygems_version: 1.8.25