omniauth-centralid 1.1.0 → 1.2.0

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
- SHA1:
3
- metadata.gz: 14047ae0d0f0ca67579bf36765ec7f0ec3102d7f
4
- data.tar.gz: 12cf8d34341394798c168647a09d02e83b31ab8b
2
+ SHA256:
3
+ metadata.gz: a6ffac9d4d3e487ac97beabf85e7a4fd5aea35e5217a33c722c0fa712646caec
4
+ data.tar.gz: f203e33e0a461d4071442100c4c48a5e672d2acdedf09cf0940e3ec175a105d2
5
5
  SHA512:
6
- metadata.gz: ea2a367ea789cfebd115b72ba3aaae494656e77721380ef88d982cbe64c60a8cf76bc9349b9253d192fed1e65cace2afcdab333c89477fcf221bc65fb45071c3
7
- data.tar.gz: 6e5ce3457b379275986d080a94dcb6d38a0f6b37e8c8a2a2e188b3bf826dd45799e76b6ef1b169f3e884695c860aff3207f1f3fff2ab7d05138e82e318873c37
6
+ metadata.gz: cb952e7dcd7ec7d85f01ee766bf03c3c43a07d1e2e644db977ff4e23481479cc900dce16b5d0db9f52a046200248f6c9bd57d1798ddc1c4600798d9cec6db985
7
+ data.tar.gz: 659b83a20646fb5cdb164318960ac2c2c8f2a8ac5c2b9116e0ecb1271ce821aa3259a1729b7c275ca092d05d015801af5f8c7351e966c3245ebfae85b97a0798
@@ -0,0 +1,9 @@
1
+ *.gem
2
+ .bundle/
3
+ log/*.log
4
+ pkg/
5
+ test/dummy/db/*.sqlite3
6
+ test/dummy/db/*.sqlite3-journal
7
+ test/dummy/log/*.log
8
+ test/dummy/tmp/
9
+ test/dummy/.sass-cache
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ ## 1.2.0 / 2018-07-03
4
+
5
+ - Upgrade `omniauth-oauth2` to 1.5
6
+
7
+ ## 1.1.0 / 2017-06-25
8
+
9
+ - Pin `omniauth-oauth2` to 1.3. to make sure custom OAuth strategy works
10
+ - Removed `multi_json` dependency
11
+
12
+ ## 1.0.0 / 2017-06-22
13
+
14
+ - Bump dependencies `multi_json` & `omniauth-oauth2`
15
+
16
+ ## 0.1.0 / 2014-12-14
17
+
18
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in omniauth-centralid.gemspec
6
+ gemspec
@@ -0,0 +1,52 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-centralid (1.1.0)
5
+ omniauth-oauth2 (~> 1.5.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ansi (1.5.0)
11
+ builder (3.2.3)
12
+ faraday (0.12.2)
13
+ multipart-post (>= 1.2, < 3)
14
+ hashie (3.5.7)
15
+ jwt (1.5.6)
16
+ minitest (5.4.3)
17
+ minitest-reporters (1.3.0)
18
+ ansi
19
+ builder
20
+ minitest (>= 5.0)
21
+ ruby-progressbar
22
+ multi_json (1.13.1)
23
+ multi_xml (0.6.0)
24
+ multipart-post (2.0.0)
25
+ oauth2 (1.4.0)
26
+ faraday (>= 0.8, < 0.13)
27
+ jwt (~> 1.0)
28
+ multi_json (~> 1.3)
29
+ multi_xml (~> 0.5)
30
+ rack (>= 1.2, < 3)
31
+ omniauth (1.8.1)
32
+ hashie (>= 3.4.6, < 3.6.0)
33
+ rack (>= 1.6.2, < 3)
34
+ omniauth-oauth2 (1.5.0)
35
+ oauth2 (~> 1.1)
36
+ omniauth (~> 1.2)
37
+ rack (2.0.5)
38
+ rake (10.4.2)
39
+ ruby-progressbar (1.9.0)
40
+
41
+ PLATFORMS
42
+ ruby
43
+
44
+ DEPENDENCIES
45
+ bundler (~> 1.16)
46
+ minitest (~> 5.0)
47
+ minitest-reporters (~> 1.3)
48
+ omniauth-centralid!
49
+ rake
50
+
51
+ BUNDLED WITH
52
+ 1.16.1
@@ -1,4 +1,4 @@
1
- Copyright 2014 YOURNAME
1
+ Copyright 2014 yafoy
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # OmniAuth Central ID
2
- [![Build Status](https://semaphoreapp.com/api/v1/projects/a1479ff0-5ef6-4182-9577-116a668c090c/309883/badge.png)](https://semaphoreapp.com/olimart/omniauth-centralid)
2
+ [![Build Status](https://semaphoreci.com/api/v1/olimart/omniauth-centralid-2/branches/master/badge.svg)](https://semaphoreci.com/olimart/omniauth-centralid-2)
3
3
 
4
4
  This gem offers OmniAuth strategy for Central ID service.
5
5
 
@@ -15,22 +15,55 @@ Next, tell OmniAuth about this provider. In a Rails app, create an initializer f
15
15
 
16
16
  ```ruby
17
17
  Rails.application.config.middleware.use OmniAuth::Builder do
18
- provider :centralid, "API_KEY", "API_SECRET"
18
+ provider :centralid, "CENTRALID_KEY", "CENTRALID_SECRET"
19
19
  end
20
20
  ```
21
+ In your routes file:
21
22
 
22
- Replace "API_KEY" and "API_SECRET" with the appropriate values created earlier.
23
+ ```ruby
24
+ get 'auth/:provider/callback', to: 'oauths#create'
25
+ get 'auth/failure', to: 'oauths#failure' # optional (to override default redirect behaviour)
26
+ ```
23
27
 
24
- ## Contributing
28
+ Add a controller (oauths_controller.rb as defined in your routes)
25
29
 
26
- Run tests with `rake test`
30
+ ```ruby
31
+ # sends the user on a trip to the provider,
32
+ # and after authorizing there back to the callback url.
33
+ def create
34
+ auth = request.env['omniauth.auth']
35
+ user = User.find_by(provider: auth['provider'], uid: auth['uid']).try(:user) || User.create_with_omniauth(auth)
36
+ # Sign in the user
37
+ session[:user_id] = user.id
38
+ redirect_to dashboard_path
39
+ end
27
40
 
28
- ## License
41
+ # By default, it is supposed to raise an exception in development mode
42
+ # and redirect otherwise. Override if needed.
43
+ def failure
44
+ redirect_to login_path
45
+ end
46
+ ```
29
47
 
30
- Copyright (c) 2014 by yafoy
48
+ And finally add a `create_with_omniauth` method in your user model.
31
49
 
32
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
50
+ ```ruby
51
+ private
33
52
 
34
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
53
+ def self.create_with_omniauth(auth)
54
+ user = create! do |user|
55
+ user.full_name = auth['info']['name']
56
+ user.email = auth['info']['email']
57
+ user.password = SecureRandom.hex
58
+ user.authentications.new(
59
+ provider: auth['provider'],
60
+ uid: auth['uid']
61
+ )
62
+ end
63
+ user
64
+ end
65
+ ```
35
66
 
36
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
67
+ ## Contributing
68
+
69
+ Run tests with `rake test`
data/Rakefile CHANGED
@@ -1,28 +1,10 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'OmniauthCentralid'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
- Bundler::GemHelper.install_tasks
18
-
19
- require 'rake/testtask'
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
20
3
 
21
4
  Rake::TestTask.new(:test) do |t|
22
- t.libs << 'lib'
23
- t.libs << 'test'
24
- t.pattern = 'test/**/*_test.rb'
25
- t.verbose = false
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
26
8
  end
27
9
 
28
- task default: :test
10
+ task :default => :test
@@ -1,3 +1,3 @@
1
1
  module OmniauthCentralid
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -28,6 +28,11 @@ module OmniAuth
28
28
  def raw_info
29
29
  @raw_info ||= access_token.get('/api/v1/me').parsed
30
30
  end
31
+
32
+ # https://github.com/intridea/omniauth-oauth2/issues/81
33
+ def callback_url
34
+ full_host + script_name + callback_path
35
+ end
31
36
  end
32
37
  end
33
38
  end
@@ -0,0 +1,35 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "omniauth-centralid/version"
4
+
5
+ # Describe your gem and declare its dependencies:
6
+ Gem::Specification.new do |s|
7
+ s.name = "omniauth-centralid"
8
+ s.version = OmniauthCentralid::VERSION
9
+ s.authors = ["yafoy"]
10
+ s.email = ["contact@yafoy.com"]
11
+ s.homepage = "http://github.com/yafoy/omniauth-centralid"
12
+ s.summary = "Central ID stategy for OmniAuth"
13
+ s.description = "This gem contains Central ID strategy for OmniAuth"
14
+ s.license = "MIT"
15
+
16
+ s.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ s.bindir = "exe"
20
+ s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+
23
+ #s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
24
+ #s.test_files = Dir["test/**/*"]
25
+
26
+ # Pin omniauth-oauth2 since v1.4.0 removed the callback_url method
27
+ # https://github.com/intridea/omniauth-oauth2/issues/93#issuecomment-227247801
28
+ # https://github.com/WebTheoryLLC/omniauth-twitch/issues/3
29
+ s.add_runtime_dependency 'omniauth-oauth2', '~> 1.5', '>= 1.5.0'
30
+
31
+ s.add_development_dependency "bundler", "~> 1.16"
32
+ s.add_development_dependency "rake"
33
+ s.add_development_dependency "minitest", "~> 5.0"
34
+ s.add_development_dependency "minitest-reporters", "~> 1.3"
35
+ end
metadata CHANGED
@@ -1,44 +1,109 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-centralid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yafoy
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-25 00:00:00.000000000 Z
11
+ date: 2018-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.3.1
19
+ version: '1.5'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.5.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - '='
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '1.5'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.5.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.16'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.16'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: minitest
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '5.0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '5.0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: minitest-reporters
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.3'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
25
87
  - !ruby/object:Gem::Version
26
- version: 1.3.1
27
- description: This gem contains the Central ID strategy for OmniAuth
88
+ version: '1.3'
89
+ description: This gem contains Central ID strategy for OmniAuth
28
90
  email:
29
91
  - contact@yafoy.com
30
92
  executables: []
31
93
  extensions: []
32
94
  extra_rdoc_files: []
33
95
  files:
96
+ - ".gitignore"
97
+ - CHANGELOG.md
98
+ - Gemfile
99
+ - Gemfile.lock
34
100
  - MIT-LICENSE
35
101
  - README.md
36
102
  - Rakefile
37
103
  - lib/omniauth-centralid.rb
38
104
  - lib/omniauth-centralid/version.rb
39
105
  - lib/omniauth/strategies/centralid.rb
40
- - test/omniauth_centralid_test.rb
41
- - test/test_helper.rb
106
+ - omniauth-centralid.gemspec
42
107
  homepage: http://github.com/yafoy/omniauth-centralid
43
108
  licenses:
44
109
  - MIT
@@ -59,10 +124,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
124
  version: '0'
60
125
  requirements: []
61
126
  rubyforge_project:
62
- rubygems_version: 2.6.11
127
+ rubygems_version: 2.7.6
63
128
  signing_key:
64
129
  specification_version: 4
65
130
  summary: Central ID stategy for OmniAuth
66
- test_files:
67
- - test/omniauth_centralid_test.rb
68
- - test/test_helper.rb
131
+ test_files: []
@@ -1,28 +0,0 @@
1
- require 'test_helper'
2
-
3
- class OmniauthCentralidTest < Minitest::Test
4
- def test_module_is_declared
5
- assert_kind_of Module, OmniauthCentralid
6
- end
7
-
8
- def test_version_is_defined
9
- refute_nil OmniauthCentralid::VERSION
10
- end
11
-
12
- def test_name_is_centralid
13
- assert name, 'centralid'
14
- end
15
-
16
- def test_site_url_is_defined
17
- assert :site, 'https://centralid.herokuapp.com'
18
- end
19
-
20
- def test_fields_are_defined
21
- assert :fields, [:name, :email]
22
- end
23
-
24
- def test_authorization_initialization
25
- # get "/auth/centralid"
26
- # assert_equal 302, last_response.status
27
- end
28
- end
@@ -1,4 +0,0 @@
1
- require 'minitest/autorun'
2
- require 'minitest/pride'
3
- include MiniTest::Assertions
4
- include MiniTest::Expectations