omniauth-seb-elink 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +74 -0
- data/Rakefile +1 -0
- data/lib/omniauth-seb-elink.rb +4 -0
- data/lib/omniauth/locales/omniauth.en.yml +5 -0
- data/lib/omniauth/locales/omniauth.lv.yml +5 -0
- data/lib/omniauth/seb.rb +2 -0
- data/lib/omniauth/seb/version.rb +5 -0
- data/lib/omniauth/strategies/seb.rb +85 -0
- data/lib/omniauth/strategies/seb/message.rb +19 -0
- data/lib/omniauth/strategies/seb/response.rb +34 -0
- data/omniauth-seb-elink.gemspec +30 -0
- data/spec/certs/response.public.pem +22 -0
- data/spec/omniauth/strategies/seb_spec.rb +116 -0
- data/spec/spec_helper.rb +17 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3efafa13a897a9b344b1d6032da283ea33e9bce5
|
4
|
+
data.tar.gz: 37aa6f644100676823f02d7e59753a6a1bc4290d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5f80b64234ab5cfeab0be8075622b3113b01850053318d0dbfa78c7cc3352128df4dec80b6928ef05f418951d369e3937109ad73e511253cf20bbd85f2d4f39b
|
7
|
+
data.tar.gz: cdd90b142b2d0787aa5e6218814af2c00794e620f951a3369233efdfc2482e966b179e5ed8b161f66eedd0d15aa8d4817d0c9928861112a643f3b5cebcb9f4c3
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2017 MAK IT
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Omniauth SEB e-link
|
2
|
+
|
3
|
+
Omniauth strategy for using SEB e-link as an authentication service provider.
|
4
|
+
|
5
|
+
[![Build Status](https://travis-ci.org/mak-it/omniauth-seb-elink.svg?branch=master)](https://travis-ci.org/mak-it/omniauth-seb-elink)
|
6
|
+
|
7
|
+
Supported Ruby versions: 2.2+
|
8
|
+
|
9
|
+
## Related projects
|
10
|
+
- [omniauth-citadele](https://github.com/mak-it/omniauth-citadele) - strategy for authenticating with Citadele
|
11
|
+
- [omniauth-dnb](https://github.com/mak-it/omniauth-dnb) - strategy for authenticating with DNB
|
12
|
+
- [omniauth-nordea](https://github.com/mak-it/omniauth-nordea) - strategy for authenticating with Nordea
|
13
|
+
- [omniauth-swedbank](https://github.com/mak-it/omniauth-swedbank) - strategy for authenticating with Swedbank
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
gem 'omniauth-seb-elink'
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install omniauth-seb-elink
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
Here's a quick example, adding the middleware to a Rails app
|
32
|
+
in `config/initializers/omniauth.rb`:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
36
|
+
provider :seb, ENV['SEB_PUBLIC_CRT'], ENV['SEB_SND_ID']
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
## Auth Hash
|
41
|
+
|
42
|
+
Here's an example Auth Hash available in `request.env['omniauth.auth']`:
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
{
|
46
|
+
provider: 'seb',
|
47
|
+
uid: '374042-80367',
|
48
|
+
info: {
|
49
|
+
full_name: 'ARNIS RAITUMS'
|
50
|
+
},
|
51
|
+
extra: {
|
52
|
+
raw_info: {
|
53
|
+
IB_SND_ID: 'SEBUB',
|
54
|
+
IB_SERVICE: '0001',
|
55
|
+
IB_REC_ID: 'TETS_SND_ID',
|
56
|
+
IB_USER: '374042-80367',
|
57
|
+
IB_DATE: '11.05.2017',
|
58
|
+
IB_TIME: '15:22:18',
|
59
|
+
IB_USER_INFO: 'ID=374042-80367;NAME=ARNIS RAITUMS',
|
60
|
+
IB_VERSION: '001',
|
61
|
+
IB_CRC: 'UYVDKsdkjsd...',
|
62
|
+
IB_LANG: 'LAT'
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
```
|
67
|
+
|
68
|
+
## Contributing
|
69
|
+
|
70
|
+
1. Fork it
|
71
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
72
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
73
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
74
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/lib/omniauth/seb.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'omniauth'
|
2
|
+
require 'base64'
|
3
|
+
require_relative 'seb/message'
|
4
|
+
require_relative 'seb/response'
|
5
|
+
|
6
|
+
module OmniAuth
|
7
|
+
module Strategies
|
8
|
+
class Seb
|
9
|
+
class ValidationError < StandardError; end
|
10
|
+
|
11
|
+
AUTH_SERVICE = '0005'
|
12
|
+
|
13
|
+
include OmniAuth::Strategy
|
14
|
+
|
15
|
+
args [:public_crt, :snd_id]
|
16
|
+
|
17
|
+
option :public_crt, nil
|
18
|
+
option :snd_id, nil
|
19
|
+
|
20
|
+
option :name, 'seb'
|
21
|
+
option :site, 'https://ibanka.seb.lv/ipc/epakindex.jsp'
|
22
|
+
|
23
|
+
uid do
|
24
|
+
request.params['IB_USER']
|
25
|
+
end
|
26
|
+
|
27
|
+
info do
|
28
|
+
user_info = request.params['IB_USER_INFO']
|
29
|
+
full_name = user_info.match(/USER=(.+)/) ? user_info.match(/USER=(.+)/)[1] : user_info.match(/NAME=(.+)/)[1]
|
30
|
+
{
|
31
|
+
full_name: full_name
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
extra do
|
36
|
+
{ raw_info: request.params }
|
37
|
+
end
|
38
|
+
|
39
|
+
def callback_phase
|
40
|
+
begin
|
41
|
+
pub_crt = OpenSSL::X509::Certificate.new(options.public_crt).public_key
|
42
|
+
rescue => e
|
43
|
+
return fail!(:public_crt_load_err, e)
|
44
|
+
end
|
45
|
+
|
46
|
+
if request.params['IB_SND_ID'] != 'SEBUB'
|
47
|
+
return fail!(:invalid_response_snd_id_err)
|
48
|
+
end
|
49
|
+
|
50
|
+
if request.params['IB_SERVICE'] != '0001'
|
51
|
+
return fail!(:invalid_response_service_err)
|
52
|
+
end
|
53
|
+
|
54
|
+
message = OmniAuth::Strategies::Seb::Response.new(request.params)
|
55
|
+
message.validate!(pub_crt)
|
56
|
+
|
57
|
+
super
|
58
|
+
rescue ValidationError => e
|
59
|
+
fail!(:invalid_response_crc, e)
|
60
|
+
end
|
61
|
+
|
62
|
+
def request_phase
|
63
|
+
fail!(:invalid_snd_id) if options.snd_id.nil?
|
64
|
+
|
65
|
+
message = OmniAuth::Strategies::Seb::Message.new(
|
66
|
+
'IB_SND_ID': options.snd_id,
|
67
|
+
'IB_SERVICE': AUTH_SERVICE,
|
68
|
+
'IB_LANG': 'LAT'
|
69
|
+
)
|
70
|
+
|
71
|
+
# Build redirect form
|
72
|
+
form = OmniAuth::Form.new(title: I18n.t('omniauth.seb.please_wait'), url: options.site)
|
73
|
+
|
74
|
+
message.each_pair do |k,v|
|
75
|
+
form.html "<input type=\"hidden\" name=\"#{k}\" value=\"#{v}\" />"
|
76
|
+
end
|
77
|
+
|
78
|
+
form.button I18n.t('omniauth.seb.click_here_if_not_redirected')
|
79
|
+
form.instance_variable_set('@html',
|
80
|
+
form.to_html.gsub('</form>', '</form><script type="text/javascript">document.forms[0].submit();</script>'))
|
81
|
+
form.to_response
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module OmniAuth
|
2
|
+
module Strategies
|
3
|
+
class Seb
|
4
|
+
class Response < Message
|
5
|
+
SIGNED_KEYS = [
|
6
|
+
'IB_SND_ID', # SEBUB
|
7
|
+
'IB_SERVICE', # 0001
|
8
|
+
'IB_REC_ID',
|
9
|
+
'IB_USER',
|
10
|
+
'IB_DATE',
|
11
|
+
'IB_TIME',
|
12
|
+
'IB_USER_INFO',
|
13
|
+
'IB_VERSION'
|
14
|
+
]
|
15
|
+
|
16
|
+
def prepend_length(value)
|
17
|
+
# prepend length to string in 0xx format
|
18
|
+
[ value.to_s.length.to_s.rjust(3, '0'), value.dup.to_s.force_encoding('ascii')].join
|
19
|
+
end
|
20
|
+
|
21
|
+
def validate!(pub_key)
|
22
|
+
raw_str = SIGNED_KEYS.map{|k| prepend_length(@hash[k])}.join
|
23
|
+
received_sig_str = Base64.decode64(@hash['IB_CRC'])
|
24
|
+
|
25
|
+
if !pub_key.verify(OpenSSL::Digest::SHA1.new, received_sig_str, raw_str)
|
26
|
+
raise ValidationError, 'Invalid signature'
|
27
|
+
end
|
28
|
+
|
29
|
+
self
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'omniauth/seb/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = 'omniauth-seb-elink'
|
8
|
+
gem.version = Omniauth::Seb::VERSION
|
9
|
+
gem.authors = ['MAK IT']
|
10
|
+
gem.email = ['admin@makit.lv']
|
11
|
+
gem.description = %q{OmniAuth strategy for SEB e-link}
|
12
|
+
gem.summary = %q{OmniAuth strategy for SEB e-link}
|
13
|
+
gem.homepage = 'https://github.com/mak-it/omniauth-seb-elink'
|
14
|
+
gem.license = 'MIT'
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
+
gem.require_paths = ['lib']
|
20
|
+
|
21
|
+
gem.required_ruby_version = '>= 2.2.2'
|
22
|
+
|
23
|
+
gem.add_runtime_dependency 'omniauth', '~> 1.0'
|
24
|
+
gem.add_runtime_dependency 'i18n'
|
25
|
+
|
26
|
+
gem.add_development_dependency 'rack-test'
|
27
|
+
gem.add_development_dependency 'rspec'
|
28
|
+
gem.add_development_dependency 'bundler'
|
29
|
+
gem.add_development_dependency 'rake'
|
30
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIDtTCCAp2gAwIBAgIJAKPVTy65V/TCMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
|
3
|
+
BAYTAkxWMRMwEQYDVQQIEwpTb21lLVN0YXRlMQ0wCwYDVQQKEwRUZXN0MRIwEAYD
|
4
|
+
VQQDEwlUZXN0IFVzZXIwHhcNMTcwNTExMTMxMzQ4WhcNMjcwNTA5MTMxMzQ4WjBF
|
5
|
+
MQswCQYDVQQGEwJMVjETMBEGA1UECBMKU29tZS1TdGF0ZTENMAsGA1UEChMEVGVz
|
6
|
+
dDESMBAGA1UEAxMJVGVzdCBVc2VyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
|
7
|
+
CgKCAQEAyIjzmr79Chp/DTsracfBJVyaOqG2S41yZZQBYS12oOySZa1zMz76X9Lp
|
8
|
+
m4qAXiPgktRJcC2iOwz9D2u+LwxCh9Sk0o2GTitZMOqvISGTkdl5sl472xA1eGrJ
|
9
|
+
CnKYD3ftPNwuaV6olTPXiyz1isNy/AyMSRAIv9r8iI+mROSqfa1lPlKEY71l+ZPq
|
10
|
+
D5FBfNn79FttyPSwqtD2wzAjbg6nx0qkE3o5S96xhxm+EZSQIBES5fulinnNjZuS
|
11
|
+
ulq6AJpwWXAyQBG/At7wGmNBdPwBvGmlBXrhBngRMjafS1aKQZFiuzA7hY09G/hl
|
12
|
+
ALgS0Cu2ZBVPMYmcRWhMWPkcM6tsPQIDAQABo4GnMIGkMB0GA1UdDgQWBBQx+6Jm
|
13
|
+
JMabKYbSbt4WKTHCKAcxuTB1BgNVHSMEbjBsgBQx+6JmJMabKYbSbt4WKTHCKAcx
|
14
|
+
uaFJpEcwRTELMAkGA1UEBhMCTFYxEzARBgNVBAgTClNvbWUtU3RhdGUxDTALBgNV
|
15
|
+
BAoTBFRlc3QxEjAQBgNVBAMTCVRlc3QgVXNlcoIJAKPVTy65V/TCMAwGA1UdEwQF
|
16
|
+
MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKntpN8+zZOddie+RVpjNYY8K0MWQdIQ
|
17
|
+
1Zadd7OndI0iIAnDJw9IAEQL1m6TTL7klRYgSHR2OX3KTcCsWKUUbSSoDhMyvJIN
|
18
|
+
wZEnXRLi6tttWJd1R1w2o37oXUfg+VhfZd+kB8Wq0FipeADUnWE4b0w2A6yDok4L
|
19
|
+
KEUNgvt3Mh86SKJrFk4NtOLkIEYIvjsruObqfkgLWwJuGIGDcpdga3kcwPF9cP8t
|
20
|
+
/Tdv/7NP785cY1IzzFZcDYg1FLAKP8mcoSCkBhB4BOojTw/XjLaNN8kw/7VE9kU3
|
21
|
+
Pjt5CV31UGp1Iq0fyImZKdYo01RrLPtX4+yh/TkW2x+J8p7Ki11wNLM=
|
22
|
+
-----END CERTIFICATE-----
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe OmniAuth::Strategies::Seb do
|
4
|
+
PUBLIC_CRT = File.read(File.join(RSpec.configuration.cert_folder, 'response.public.pem'))
|
5
|
+
SND_ID = 'AAA'
|
6
|
+
|
7
|
+
let(:app){ Rack::Builder.new do |b|
|
8
|
+
b.use Rack::Session::Cookie, {secret: 'abc123'}
|
9
|
+
b.use OmniAuth::Strategies::Seb, PUBLIC_CRT, SND_ID
|
10
|
+
b.run lambda{|env| [404, {}, ['Not Found']]}
|
11
|
+
end.to_app }
|
12
|
+
|
13
|
+
context 'request phase' do
|
14
|
+
before(:each) { get '/auth/seb' }
|
15
|
+
|
16
|
+
it 'displays a single form' do
|
17
|
+
expect(last_response.status).to eq(200)
|
18
|
+
expect(last_response.body.scan('<form').size).to eq(1)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'has JavaScript code to submit the form after it is created' do
|
22
|
+
expect(last_response.body).to be_include('</form><script type="text/javascript">document.forms[0].submit();</script>')
|
23
|
+
end
|
24
|
+
|
25
|
+
EXPECTED_VALUES = {
|
26
|
+
'IB_SND_ID': SND_ID,
|
27
|
+
'IB_SERVICE': OmniAuth::Strategies::Seb::AUTH_SERVICE,
|
28
|
+
'IB_LANG': 'LAT'
|
29
|
+
}
|
30
|
+
|
31
|
+
EXPECTED_VALUES.each_pair do |k,v|
|
32
|
+
it "has hidden input field #{k} => #{v}" do
|
33
|
+
expect(last_response.body).to include(
|
34
|
+
"<input type=\"hidden\" name=\"#{k}\" value=\"#{v}\""
|
35
|
+
)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'callback phase' do
|
41
|
+
let(:auth_hash){ last_request.env['omniauth.auth'] }
|
42
|
+
|
43
|
+
context "with valid response" do
|
44
|
+
before do
|
45
|
+
post '/auth/seb/callback',
|
46
|
+
'IB_SND_ID': 'SEBUB',
|
47
|
+
'IB_SERVICE': '0001',
|
48
|
+
'IB_REC_ID': 'AAA',
|
49
|
+
'IB_USER': '050505-12123',
|
50
|
+
'IB_DATE': '05.12.2003',
|
51
|
+
'IB_TIME': '10:00:00',
|
52
|
+
'IB_USER_INFO': 'ID=050505-12123;NAME=JOHN DOE',
|
53
|
+
'IB_VERSION': '001',
|
54
|
+
'IB_CRC': 'PBlZ54E1tWoPIsyHPQvDAepiEm6/cDoIrvqGDXbRzGz7wEhXHrZxM5DxeC7XkI2IzFycTws8LLyYZXP3AluAvGoCgj/WYlLjcReLk6v4W0z1+KLGqQKpiOh+CTPjWU+VCMB9jMzbJ+p4hXiC8qQge3Y3ovsNcZjvbJJ5WMhSyv7AhHA2qcMYfYpByu7pD67QqNOh3fanpRRrQNmM2ebnVhVFQZ4xlDvWMyK2Rhfl/VigeNo7cCsPcRGcelBSTj+JmQukhIgPMhLrGFs31qNfVA2khQpY2puGv1yUz9tFG+CgoLJyBSFYexSk0qcgr5CCpEBMVcaaa/sy1FHcXKA7mg==',
|
55
|
+
'IB_LANG': 'LAT'
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'sets the correct uid value in the auth hash' do
|
59
|
+
expect(auth_hash.uid).to eq('050505-12123')
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'sets the correct info.full_name value in the auth hash' do
|
63
|
+
expect(auth_hash.info.full_name).to eq('JOHN DOE')
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'with non-existant public key file' do
|
68
|
+
let(:app){ Rack::Builder.new do |b|
|
69
|
+
b.use Rack::Session::Cookie, {secret: 'abc123'}
|
70
|
+
b.use(OmniAuth::Strategies::Seb, 'missing-public-key-file.pem', SND_ID )
|
71
|
+
b.run lambda{|env| [404, {}, ['Not Found']]}
|
72
|
+
end.to_app }
|
73
|
+
|
74
|
+
it 'redirects to /auth/failure with appropriate query params' do
|
75
|
+
post '/auth/seb/callback' # Params are not important, because we're testing public key loading
|
76
|
+
expect(last_response.status).to eq(302)
|
77
|
+
expect(last_response.headers['Location']).to eq('/auth/failure?message=public_crt_load_err&strategy=seb')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'with non-existant SND ID' do
|
82
|
+
let(:app){ Rack::Builder.new do |b|
|
83
|
+
b.use Rack::Session::Cookie, {secret: 'abc123'}
|
84
|
+
b.use(OmniAuth::Strategies::Seb, PUBLIC_CRT, nil )
|
85
|
+
b.run lambda{|env| [404, {}, ['Not Found']]}
|
86
|
+
end.to_app }
|
87
|
+
|
88
|
+
it 'redirects to /auth/failure with appropriate query params' do
|
89
|
+
post '/auth/seb/callback' # Params are not important, because we're testing public key loading
|
90
|
+
expect(last_response.status).to eq(302)
|
91
|
+
expect(last_response.headers['Location']).to eq('/auth/failure?message=invalid_response_snd_id_err&strategy=seb')
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
context "with invalid MAC" do
|
96
|
+
before do
|
97
|
+
post '/auth/seb/callback',
|
98
|
+
'IB_SND_ID': 'SEBUB',
|
99
|
+
'IB_SERVICE': '0001',
|
100
|
+
'IB_REC_ID': 'AAA',
|
101
|
+
'IB_USER': '050505-12123',
|
102
|
+
'IB_DATE': '05.12.2003',
|
103
|
+
'IB_TIME': '10:00:00',
|
104
|
+
'IB_USER_INFO': 'ID=050505-12123;NAME=JOHN DOE',
|
105
|
+
'IB_VERSION': '001',
|
106
|
+
'IB_CRC': 'invalid_crc',
|
107
|
+
'IB_LANG': 'LAT'
|
108
|
+
end
|
109
|
+
|
110
|
+
it "fails with invalid_mac error" do
|
111
|
+
expect(auth_hash).to eq(nil)
|
112
|
+
expect(last_request.env['omniauth.error.type']).to eq(:invalid_response_crc)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require 'rspec'
|
4
|
+
require 'rack/test'
|
5
|
+
require 'omniauth'
|
6
|
+
require 'omniauth-seb-elink'
|
7
|
+
|
8
|
+
RSpec.configure do |config|
|
9
|
+
config.add_setting('cert_folder')
|
10
|
+
config.cert_folder = File.expand_path('../certs', __FILE__)
|
11
|
+
|
12
|
+
config.include Rack::Test::Methods
|
13
|
+
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
14
|
+
config.expect_with :rspec do |c|
|
15
|
+
c.syntax = :expect
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-seb-elink
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- MAK IT
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: i18n
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rack-test
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: OmniAuth strategy for SEB e-link
|
98
|
+
email:
|
99
|
+
- admin@makit.lv
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
106
|
+
- Gemfile
|
107
|
+
- LICENSE.txt
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- lib/omniauth-seb-elink.rb
|
111
|
+
- lib/omniauth/locales/omniauth.en.yml
|
112
|
+
- lib/omniauth/locales/omniauth.lv.yml
|
113
|
+
- lib/omniauth/seb.rb
|
114
|
+
- lib/omniauth/seb/version.rb
|
115
|
+
- lib/omniauth/strategies/seb.rb
|
116
|
+
- lib/omniauth/strategies/seb/message.rb
|
117
|
+
- lib/omniauth/strategies/seb/response.rb
|
118
|
+
- omniauth-seb-elink.gemspec
|
119
|
+
- spec/certs/response.public.pem
|
120
|
+
- spec/omniauth/strategies/seb_spec.rb
|
121
|
+
- spec/spec_helper.rb
|
122
|
+
homepage: https://github.com/mak-it/omniauth-seb-elink
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 2.2.2
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.4.8
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: OmniAuth strategy for SEB e-link
|
146
|
+
test_files:
|
147
|
+
- spec/certs/response.public.pem
|
148
|
+
- spec/omniauth/strategies/seb_spec.rb
|
149
|
+
- spec/spec_helper.rb
|