omniauth-fidor 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ M2YyNzhiNzYzOGNiMWIyZjFlY2Y0MThmMmU3ZDlkNGRmZTk4MTcxNg==
5
+ data.tar.gz: !binary |-
6
+ NGQ4M2IxZDk3ZDNlYWRlOGE3ZGEwMWMxMzQzNWI4MGNkOTZkNjI4ZA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZjY5NmM0ZTYzN2E2ODdmN2NkNWU3ZmUzOTE5MGIzOWZhM2U4YWNhODZiNzU1
10
+ YmFjODA0NWYyZWJhMDc4OWIxZjMyNWYzYzQ5NGUzNzYyZTVhZmI5YzUyNmM1
11
+ Zjk0MzI4NWViMWFjYjI1YWYwZDgxYmFjM2QzZGExMzMxMTliODU=
12
+ data.tar.gz: !binary |-
13
+ OTU2MjAzMTU1MmI1MDhiMDdmMDhiMDk1ZGVhOTZmZWRiMzE3MzE1ZjNmMDJk
14
+ NjljZGMyODE0Nzk5MDY0NGJlOTkxNGFjMDcxYjE0NmJlNjE3YWUzZWRiMTRk
15
+ NTAzM2FlMDVmMjJiNmRjYTlhZDEzMzBmNGMzZDI2NzNiNjkwYmM=
data/CHANGELOG ADDED
@@ -0,0 +1 @@
1
+ v0.0.0 Initial version.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Sasha Gerrand
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Manifest ADDED
@@ -0,0 +1,13 @@
1
+ CHANGELOG
2
+ LICENSE.txt
3
+ Manifest
4
+ README.md
5
+ Rakefile
6
+ lib/omniauth-fidor.rb
7
+ lib/omniauth/fidor/config.rb
8
+ lib/omniauth/fidor/version.rb
9
+ lib/omniauth/strategies/fidor.rb
10
+ test/helper.rb
11
+ test/omniauth/fidor/config_test.rb
12
+ test/omniauth/fidor/version_test.rb
13
+ test/omniauth/strategies/fidor_test.rb
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # OmniAuth Fidor
2
+
3
+ [![Build Status](https://travis-ci.org/sgerrand/omniauth-fidor.svg?branch=master)](https://travis-ci.org/sgerrand/omniauth-fidor)
4
+ [![Code Climate](https://codeclimate.com/github/sgerrand/omniauth-fidor/badges/gpa.svg)](https://codeclimate.com/github/sgerrand/omniauth-fidor)
5
+ [![Test Coverage](https://codeclimate.com/github/sgerrand/omniauth-fidor/badges/coverage.svg)](https://codeclimate.com/github/sgerrand/omniauth-fidor/coverage)
6
+
7
+ This is a OmniAuth strategy for authenticating to [Fidor
8
+ Banking][fidor-banking]. To use it, you'll need to sign up for an OAuth2
9
+ Application ID and Secret on the [Fidor Developer Page][fidor-developers].
10
+
11
+ [fidor-banking]: https://www.fidor.de/
12
+ [fidor-developers]: https://developer.fidor.de/
13
+
14
+ ## Basic Usage
15
+
16
+ ## Installation
17
+
18
+ Add this line to your application's Gemfile:
19
+
20
+ ```ruby
21
+ gem 'omniauth-fidor'
22
+ ```
23
+
24
+ And then execute:
25
+
26
+ $ bundle
27
+
28
+ Or install it yourself as:
29
+
30
+ $ gem install omniauth-fidor
31
+
32
+ ## Usage
33
+
34
+ ```ruby
35
+ use OmniAuth::Builder do
36
+ provider :fidor, ENV['FIDOR_KEY'], ENV['FIDOR_SECRET']
37
+ end
38
+ ```
39
+
40
+ ## Development
41
+
42
+ After checking out the repo, run `rake install:development` to install
43
+ dependencies. Then, run `rake test` to run the tests.
44
+
45
+ To install this gem onto your local machine, run `rake install`. To release a
46
+ new version, update the version number in the `CHANGELOG`, and then run `rake
47
+ release`, which will create a git tag for the version, push git commits and
48
+ tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
49
+
50
+ You can also override the API and OAuth URLs used by setting values for the
51
+ `FIDOR_API_URL` and/or `FIDOR_OAUTH_URL` environment variables.
52
+
53
+ ## Contributing
54
+
55
+ Bug reports and pull requests are welcome on [GitHub](https://github.com/sgerrand/omniauth-fidor).
56
+
57
+ ## License
58
+
59
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require 'echoe'
2
+
3
+ Echoe.new('omniauth-fidor') do |gem|
4
+ gem.author = 'Sasha Gerrand'
5
+ gem.email = 'rubygems-omniauth-fidor@sgerrand.com'
6
+ gem.summary = %q{OmniAuth strategy for the Fidor Banking API.}
7
+ gem.description = %q{An OmniAuth OAuth2 based strategy for the Fidor Banking API.}
8
+ gem.url = 'https://github.com/sgerrand/omniauth-fidor'
9
+ gem.licenses = 'MIT'
10
+ gem.ruby_version = '>= 2.0'
11
+ gem.development_dependencies = ['bundler ~>1.11', 'codeclimate-test-reporter', 'rake ~>10.0', 'minitest ~>5.0']
12
+ # Nothing lower than omniauth-oauth2 1.1.1
13
+ # http://www.rubysec.com/advisories/CVE-2012-6134/
14
+ gem.runtime_dependencies = ['omniauth ~>1.0', 'omniauth-oauth2 ~>1.3.1']
15
+ end
@@ -0,0 +1,31 @@
1
+ require 'uri'
2
+
3
+ module OmniAuth
4
+ module Fidor
5
+ class Config
6
+ class << self
7
+ def authorize_url
8
+ oauth_url + '/oauth/authorize'
9
+ end
10
+
11
+ def site
12
+ api_url + '/'
13
+ end
14
+
15
+ def token_url
16
+ oauth_url + '/oauth/token'
17
+ end
18
+
19
+ private
20
+
21
+ def api_url
22
+ ENV['FIDOR_API_URL'] || 'https://api.fidor.de'
23
+ end
24
+
25
+ def oauth_url
26
+ ENV['FIDOR_OAUTH_URL'] || 'https://apm.fidor.de'
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Fidor
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,56 @@
1
+ require 'omniauth-oauth2'
2
+ require 'omniauth/fidor/config'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Fidor < OmniAuth::Strategies::OAuth2
7
+ option :authorize_options, [:authorization_code]
8
+
9
+ option :client_options, {
10
+ :authorize_url => OmniAuth::Fidor::Config.authorize_url,
11
+ :site => OmniAuth::Fidor::Config.site,
12
+ :token_url => OmniAuth::Fidor::Config.token_url,
13
+ }
14
+
15
+ option :scope, ['user']
16
+
17
+ def request_phase
18
+ super
19
+ end
20
+
21
+ def authorize_params
22
+ super.tap do |params|
23
+ %w[client_options scopes].each do |v|
24
+ if request.params[v]
25
+ params[v.to_sym] = request.params[v]
26
+ end
27
+ end
28
+ end
29
+ end
30
+
31
+ uid { raw_info['id'].to_s }
32
+
33
+ info do
34
+ {
35
+ 'created_at' => raw_info['created_at'],
36
+ 'email' => raw_info['email'],
37
+ 'last_sign_in_at' => raw_info['last_sign_in_at'],
38
+ 'updated_at' => raw_info['updated_at'],
39
+ }
40
+ end
41
+
42
+ extra do
43
+ {:raw_info => raw_info}
44
+ end
45
+
46
+ def raw_info
47
+ access_token.options[:mode] = :query
48
+ @raw_info ||= access_token.get('users/current').parsed
49
+ end
50
+
51
+ def email
52
+ raw_info['email']
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,2 @@
1
+ require 'omniauth/fidor/version'
2
+ require 'omniauth/strategies/fidor'
@@ -0,0 +1,51 @@
1
+ # -*- encoding: utf-8 -*-
2
+ # stub: omniauth-fidor 0.0.0 ruby lib
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "omniauth-fidor"
6
+ s.version = "0.0.0"
7
+
8
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
9
+ s.require_paths = ["lib"]
10
+ s.authors = ["Sasha Gerrand"]
11
+ s.date = "2016-04-17"
12
+ s.description = "An OmniAuth OAuth2 based strategy for the Fidor Banking API."
13
+ s.email = "rubygems-omniauth-fidor@sgerrand.com"
14
+ s.extra_rdoc_files = ["CHANGELOG", "LICENSE.txt", "README.md", "lib/omniauth-fidor.rb", "lib/omniauth/fidor/config.rb", "lib/omniauth/fidor/version.rb", "lib/omniauth/strategies/fidor.rb"]
15
+ s.files = ["CHANGELOG", "LICENSE.txt", "Manifest", "README.md", "Rakefile", "lib/omniauth-fidor.rb", "lib/omniauth/fidor/config.rb", "lib/omniauth/fidor/version.rb", "lib/omniauth/strategies/fidor.rb", "omniauth-fidor.gemspec", "test/helper.rb", "test/omniauth/fidor/config_test.rb", "test/omniauth/fidor/version_test.rb", "test/omniauth/strategies/fidor_test.rb"]
16
+ s.homepage = "https://github.com/sgerrand/omniauth-fidor"
17
+ s.licenses = ["MIT"]
18
+ s.rdoc_options = ["--line-numbers", "--title", "Omniauth-fidor", "--main", "README.md"]
19
+ s.required_ruby_version = Gem::Requirement.new(">= 2.0")
20
+ s.rubyforge_project = "omniauth-fidor"
21
+ s.rubygems_version = "2.4.5"
22
+ s.summary = "OmniAuth strategy for the Fidor Banking API."
23
+ s.test_files = ["test/omniauth/fidor/config_test.rb", "test/omniauth/fidor/version_test.rb", "test/omniauth/strategies/fidor_test.rb"]
24
+
25
+ if s.respond_to? :specification_version then
26
+ s.specification_version = 4
27
+
28
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
29
+ s.add_runtime_dependency(%q<omniauth>, ["~> 1.0"])
30
+ s.add_runtime_dependency(%q<omniauth-oauth2>, ["~> 1.3.1"])
31
+ s.add_development_dependency(%q<bundler>, ["~> 1.11"])
32
+ s.add_development_dependency(%q<codeclimate-test-reporter>, [">= 0"])
33
+ s.add_development_dependency(%q<rake>, ["~> 10.0"])
34
+ s.add_development_dependency(%q<minitest>, ["~> 5.0"])
35
+ else
36
+ s.add_dependency(%q<omniauth>, ["~> 1.0"])
37
+ s.add_dependency(%q<omniauth-oauth2>, ["~> 1.3.1"])
38
+ s.add_dependency(%q<bundler>, ["~> 1.11"])
39
+ s.add_dependency(%q<codeclimate-test-reporter>, [">= 0"])
40
+ s.add_dependency(%q<rake>, ["~> 10.0"])
41
+ s.add_dependency(%q<minitest>, ["~> 5.0"])
42
+ end
43
+ else
44
+ s.add_dependency(%q<omniauth>, ["~> 1.0"])
45
+ s.add_dependency(%q<omniauth-oauth2>, ["~> 1.3.1"])
46
+ s.add_dependency(%q<bundler>, ["~> 1.11"])
47
+ s.add_dependency(%q<codeclimate-test-reporter>, [">= 0"])
48
+ s.add_dependency(%q<rake>, ["~> 10.0"])
49
+ s.add_dependency(%q<minitest>, ["~> 5.0"])
50
+ end
51
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,6 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start if ENV['CODECLIMATE_REPO_TOKEN']
3
+ require 'omniauth-fidor'
4
+
5
+ require 'minitest/autorun'
6
+ require 'minitest/pride'
@@ -0,0 +1,59 @@
1
+ require 'helper'
2
+
3
+ class OmniAuth::Fidor::ConfigTest < Minitest::Test
4
+ def test_that_it_has_a_authorize_url
5
+ refute_nil ::OmniAuth::Fidor::Config.authorize_url
6
+ end
7
+
8
+ def test_default_value_for_authorize_url
9
+ assert_equal 'https://apm.fidor.de/oauth/authorize',
10
+ ::OmniAuth::Fidor::Config.authorize_url
11
+ end
12
+
13
+ def test_override_value_for_authorize_url
14
+ around_env_url('FIDOR_OAUTH_URL', 'https://another.url') do
15
+ assert_equal 'https://another.url/oauth/authorize',
16
+ ::OmniAuth::Fidor::Config.authorize_url
17
+ end
18
+ end
19
+
20
+ def test_that_it_has_a_site
21
+ refute_nil ::OmniAuth::Fidor::Config.site
22
+ end
23
+
24
+ def test_default_value_for_site
25
+ assert_equal 'https://api.fidor.de/',
26
+ ::OmniAuth::Fidor::Config.site
27
+ end
28
+
29
+ def test_override_value_for_site
30
+ around_env_url('FIDOR_API_URL', 'https://another.url') do
31
+ assert_equal 'https://another.url/',
32
+ ::OmniAuth::Fidor::Config.site
33
+ end
34
+ end
35
+
36
+ def test_that_it_has_a_token_url
37
+ refute_nil ::OmniAuth::Fidor::Config.token_url
38
+ end
39
+
40
+ def test_default_value_for_token_url
41
+ assert_equal 'https://apm.fidor.de/oauth/token',
42
+ ::OmniAuth::Fidor::Config.token_url
43
+ end
44
+
45
+ def test_override_value_for_token_url
46
+ around_env_url('FIDOR_OAUTH_URL', 'https://another.url') do
47
+ assert_equal 'https://another.url/oauth/token',
48
+ ::OmniAuth::Fidor::Config.token_url
49
+ end
50
+ end
51
+
52
+ private
53
+
54
+ def around_env_url(env_key, url, &block)
55
+ ENV[env_key] = url
56
+ yield block.call
57
+ ENV[env_key] = nil
58
+ end
59
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class OmniAuth::FidorTest < Minitest::Test
4
+ def test_that_it_has_a_version_number
5
+ refute_nil ::OmniAuth::Fidor::VERSION
6
+ end
7
+ end
@@ -0,0 +1,33 @@
1
+ require 'helper'
2
+
3
+ class OmniAuth::Strategies::FidorTest < Minitest::Test
4
+ def setup
5
+ app = lambda { |_env| [404, {}, ['Awesome']] }
6
+ @subject = OmniAuth::Strategies::Fidor.new(app)
7
+ OmniAuth.config.test_mode = true
8
+ end
9
+
10
+ def teardown
11
+ OmniAuth.config.test_mode = false
12
+ end
13
+
14
+ def test_options_has_correct_name
15
+ assert_equal 'fidor', @subject.options.name
16
+ end
17
+
18
+ def test_options_does_not_set_provider_ignore_state
19
+ refute @subject.options.provider_ignores_state
20
+ end
21
+
22
+ def test_client_options_has_correct_site
23
+ assert_equal 'https://api.fidor.de/', @subject.options.client_options.site
24
+ end
25
+
26
+ def test_client_options_has_correct_authorize_url
27
+ assert_equal 'https://apm.fidor.de/oauth/authorize', @subject.options.client_options.authorize_url
28
+ end
29
+
30
+ def test_client_options_has_correct_token_url
31
+ assert_equal 'https://apm.fidor.de/oauth/token', @subject.options.client_options.token_url
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-fidor
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Sasha Gerrand
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-04-17 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: omniauth-oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.3.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 1.3.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.11'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.11'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codeclimate-test-reporter
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: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '5.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '5.0'
97
+ description: An OmniAuth OAuth2 based strategy for the Fidor Banking API.
98
+ email: rubygems-omniauth-fidor@sgerrand.com
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files:
102
+ - CHANGELOG
103
+ - LICENSE.txt
104
+ - README.md
105
+ - lib/omniauth-fidor.rb
106
+ - lib/omniauth/fidor/config.rb
107
+ - lib/omniauth/fidor/version.rb
108
+ - lib/omniauth/strategies/fidor.rb
109
+ files:
110
+ - CHANGELOG
111
+ - LICENSE.txt
112
+ - Manifest
113
+ - README.md
114
+ - Rakefile
115
+ - lib/omniauth-fidor.rb
116
+ - lib/omniauth/fidor/config.rb
117
+ - lib/omniauth/fidor/version.rb
118
+ - lib/omniauth/strategies/fidor.rb
119
+ - omniauth-fidor.gemspec
120
+ - test/helper.rb
121
+ - test/omniauth/fidor/config_test.rb
122
+ - test/omniauth/fidor/version_test.rb
123
+ - test/omniauth/strategies/fidor_test.rb
124
+ homepage: https://github.com/sgerrand/omniauth-fidor
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options:
130
+ - --line-numbers
131
+ - --title
132
+ - Omniauth-fidor
133
+ - --main
134
+ - README.md
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '2.0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ! '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '1.2'
147
+ requirements: []
148
+ rubyforge_project: omniauth-fidor
149
+ rubygems_version: 2.4.5
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: OmniAuth strategy for the Fidor Banking API.
153
+ test_files:
154
+ - test/omniauth/fidor/config_test.rb
155
+ - test/omniauth/fidor/version_test.rb
156
+ - test/omniauth/strategies/fidor_test.rb