omniauth-dropbox2 1.0.4 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: dcd4c323a593ed19bf1b07090b02707195e34f5b
4
- data.tar.gz: cf27405720eafa81aafd3dd2caa5a089e5673041
2
+ SHA256:
3
+ metadata.gz: e3eef391059ca6c83db36598b65c25d6aece1d4c874959f7ff394f42d422df7b
4
+ data.tar.gz: 9b5b76cbbc95699bd4bad97287a7818572ae9a11617898f07a1c174e7e3e672d
5
5
  SHA512:
6
- metadata.gz: 2b6e62180b87ce02d7a286fc0d06f68f30017d28b717a704bf91e0a5160c2759ab3dedb5ec2fd40f34e5c8dea3bc5c5f8981489f764efca4e35f6909f451a3db
7
- data.tar.gz: 47113ca51f85f6009f58a2f7cddb090fff812804c6edc9491ddcf0162442654ac829097ec88c48a25da35459b9d1ac18d231211e2f9e0ca89e2cd0870318e840
6
+ metadata.gz: 86813f111b4a7d29998878c324886ec0a45f661ff30e16da696fd97f7591fe43bbbe91456a1ad45370260e29012033496e22d20b5fc6fb17a2f81ccd8d8ef308
7
+ data.tar.gz: 5a57fef8cdcd663031be45e79c3f34a2ac627b13b05fdecfadecbedbf23e4837dd5dfe2dd82195249ee04bc889d59d9bddf74d8aa5e3fab5c859805b95c06718
data/README.md CHANGED
@@ -1,29 +1,66 @@
1
- # OmniAuth Dropbox Strategy
1
+ # OmniAuth Dropbox2 Strategy
2
2
 
3
- This gem provides a simple way to authenticate to Dropbox using OmniAuth with OAuth2.
3
+ `omniauth-dropbox2` provides a Dropbox OAuth2 strategy for OmniAuth.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'omniauth-dropbox2'
9
+ ```ruby
10
+ gem 'omniauth-dropbox2'
11
+ ```
10
12
 
11
- And then execute:
13
+ Then run:
12
14
 
13
- $ bundle
15
+ ```bash
16
+ bundle install
17
+ ```
14
18
 
15
- Or install it yourself as:
19
+ ## Usage
16
20
 
17
- $ gem install omniauth-dropbox2
21
+ Configure OmniAuth in your Rack/Rails app:
18
22
 
19
- ## Usage
23
+ ```ruby
24
+ use OmniAuth::Builder do
25
+ provider :dropbox, ENV.fetch('DROPBOX_APP_KEY'), ENV.fetch('DROPBOX_APP_SECRET')
26
+ end
27
+ ```
28
+
29
+ Auth hash includes:
30
+
31
+ - `uid`: Dropbox `account_id`
32
+ - `info[:name]`: Dropbox display name
33
+ - `extra['raw_info']`: full response from `users/get_current_account`
34
+
35
+ ## Development
36
+
37
+ ```bash
38
+ bundle install
39
+ bundle exec rake
40
+ ```
41
+
42
+ The default Rake task runs:
43
+
44
+ - `rake lint` (RuboCop)
45
+ - `rake test_unit` (strategy/unit Minitest suite)
46
+
47
+ Run Rails integration tests with an explicit Rails version:
48
+
49
+ ```bash
50
+ RAILS_VERSION='~> 8.1.0' bundle install
51
+ RAILS_VERSION='~> 8.1.0' bundle exec rake test_rails_integration
52
+ ```
53
+
54
+ ## Compatibility
55
+
56
+ - Ruby: `>= 3.2` (tested on `3.2`, `3.3`, `3.4`, `4.0`)
57
+ - `omniauth-oauth2`: `>= 1.8`, `< 1.9`
58
+ - Rails integration lanes: `~> 7.1.0`, `~> 7.2.0`, `~> 8.0.0`, `~> 8.1.0`
59
+
60
+ ## Release
20
61
 
21
- TODO: Write usage instructions here
62
+ Tag releases as `vX.Y.Z`; GitHub Actions publishes the gem to RubyGems.
22
63
 
23
- ## Contributing
64
+ ## License
24
65
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
66
+ MIT
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAuth
4
+ module Dropbox2
5
+ VERSION = '2.0.0'
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth/dropbox2/version'
4
+ require 'omniauth/strategies/dropbox'
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth-oauth2'
4
+
5
+ module OmniAuth
6
+ module Strategies
7
+ # OmniAuth strategy for Dropbox OAuth2.
8
+ class Dropbox < OmniAuth::Strategies::OAuth2
9
+ option :name, 'dropbox'
10
+
11
+ option :client_options,
12
+ site: 'https://api.dropboxapi.com/2',
13
+ authorize_url: 'https://www.dropbox.com/oauth2/authorize',
14
+ token_url: 'https://api.dropboxapi.com/oauth2/token',
15
+ connection_opts: {
16
+ headers: {
17
+ user_agent: 'icoretech-omniauth-dropbox2 gem',
18
+ accept: 'application/json',
19
+ content_type: 'application/json'
20
+ }
21
+ }
22
+
23
+ uid { raw_info['account_id'] }
24
+
25
+ info do
26
+ {
27
+ name: raw_info.dig('name', 'display_name')
28
+ }.compact
29
+ end
30
+
31
+ extra do
32
+ {
33
+ 'raw_info' => raw_info
34
+ }
35
+ end
36
+
37
+ def raw_info
38
+ @raw_info ||= access_token.post('users/get_current_account', body: '{}').parsed
39
+ end
40
+
41
+ def callback_url
42
+ return '' if @authorization_code_from_signed_request
43
+
44
+ options[:callback_url] || super
45
+ end
46
+
47
+ def query_string
48
+ return '' if request.params['code']
49
+
50
+ super
51
+ end
52
+ end
53
+
54
+ Dropbox2 = Dropbox
55
+ end
56
+ end
@@ -1,5 +1,3 @@
1
- module Omniauth
2
- module Box2
3
- VERSION = "1.0.4"
4
- end
5
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth/dropbox2/version'
@@ -1,41 +1,3 @@
1
- require 'omniauth/strategies/oauth2'
1
+ # frozen_string_literal: true
2
2
 
3
- module OmniAuth
4
- module Strategies
5
- class Dropbox < OmniAuth::Strategies::OAuth2
6
- # Give your strategy a name.
7
- option :name, 'dropbox'
8
-
9
- # This is where you pass the options you would pass when
10
- # initializing your consumer from the OAuth gem.
11
- option :client_options,
12
- site: 'https://api.dropbox.com/2',
13
- authorize_url: 'https://www.dropbox.com/oauth2/authorize',
14
- token_url: 'https://api.dropbox.com/oauth2/token',
15
- connection_opts: { headers: { user_agent: 'Omniauth-Dropbox2', accept: 'application/json', content_type: 'application/json' } }
16
-
17
- # These are called after authentication has succeeded. If
18
- # possible, you should try to set the UID without making
19
- # additional calls (if the user id is returned with the token
20
- # or as a URI parameter). This may not be possible with all
21
- # providers.
22
- uid { raw_info['account_id'] }
23
-
24
- info do
25
- {
26
- name: raw_info['name']['display_name']
27
- }
28
- end
29
-
30
- extra do
31
- {
32
- 'raw_info' => raw_info
33
- }
34
- end
35
-
36
- def raw_info
37
- @raw_info ||= access_token.post('users/get_current_account', body: nil.to_json).parsed
38
- end
39
- end
40
- end
41
- end
3
+ require 'omniauth/dropbox2'
@@ -1,21 +1,34 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'omniauth-dropbox2/version'
5
+ require 'omniauth/dropbox2/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'omniauth-dropbox2'
9
+ spec.version = OmniAuth::Dropbox2::VERSION
10
+ spec.authors = ['Claudio Poli']
11
+ spec.email = ['masterkain@gmail.com']
12
+
13
+ spec.summary = 'OmniAuth strategy for Dropbox OAuth2 authentication.'
14
+ spec.description = 'OAuth2 strategy for OmniAuth that authenticates users with Dropbox and exposes account metadata.'
15
+ spec.homepage = 'https://github.com/icoretech/omniauth-dropbox2'
16
+ spec.license = 'MIT'
17
+ spec.required_ruby_version = '>= 3.2'
5
18
 
6
- Gem::Specification.new do |gem|
7
- gem.name = "omniauth-dropbox2"
8
- gem.version = Omniauth::Box2::VERSION
9
- gem.authors = ["Claudio Poli"]
10
- gem.email = ["masterkain@gmail.com\n"]
11
- gem.description = %q{OmniAuth strategy for Dropbox using OAuth2}
12
- gem.summary = %q{OmniAuth strategy for Dropbox using OAuth2}
13
- gem.homepage = "https://github.com/masterkain/omniauth-dropbox2"
19
+ spec.metadata['source_code_uri'] = 'https://github.com/icoretech/omniauth-dropbox2'
20
+ spec.metadata['bug_tracker_uri'] = 'https://github.com/icoretech/omniauth-dropbox2/issues'
21
+ spec.metadata['changelog_uri'] = 'https://github.com/icoretech/omniauth-dropbox2/releases'
22
+ spec.metadata['rubygems_mfa_required'] = 'true'
14
23
 
15
- gem.files = `git ls-files`.split($/)
16
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
- gem.require_paths = ["lib"]
24
+ spec.files = Dir[
25
+ 'lib/**/*.rb',
26
+ 'README*',
27
+ 'LICENSE*',
28
+ '*.gemspec'
29
+ ]
30
+ spec.require_paths = ['lib']
19
31
 
20
- gem.add_dependency 'omniauth', '~> 1.0'
32
+ spec.add_dependency 'cgi', '>= 0.3.6'
33
+ spec.add_dependency 'omniauth-oauth2', '>= 1.8', '< 1.9'
21
34
  end
metadata CHANGED
@@ -1,50 +1,72 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-dropbox2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Poli
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2016-12-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: omniauth
13
+ name: cgi
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - "~>"
16
+ - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '1.0'
18
+ version: 0.3.6
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - "~>"
23
+ - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: '1.0'
27
- description: OmniAuth strategy for Dropbox using OAuth2
25
+ version: 0.3.6
26
+ - !ruby/object:Gem::Dependency
27
+ name: omniauth-oauth2
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '1.8'
33
+ - - "<"
34
+ - !ruby/object:Gem::Version
35
+ version: '1.9'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '1.8'
43
+ - - "<"
44
+ - !ruby/object:Gem::Version
45
+ version: '1.9'
46
+ description: OAuth2 strategy for OmniAuth that authenticates users with Dropbox and
47
+ exposes account metadata.
28
48
  email:
29
- - 'masterkain@gmail.com
30
-
31
- '
49
+ - masterkain@gmail.com
32
50
  executables: []
33
51
  extensions: []
34
52
  extra_rdoc_files: []
35
53
  files:
36
- - ".gitignore"
37
- - Gemfile
38
54
  - LICENSE.txt
39
55
  - README.md
40
- - Rakefile
41
56
  - lib/omniauth-dropbox2.rb
42
57
  - lib/omniauth-dropbox2/version.rb
58
+ - lib/omniauth/dropbox2.rb
59
+ - lib/omniauth/dropbox2/version.rb
60
+ - lib/omniauth/strategies/dropbox.rb
43
61
  - omniauth-dropbox2.gemspec
44
- homepage: https://github.com/masterkain/omniauth-dropbox2
45
- licenses: []
46
- metadata: {}
47
- post_install_message:
62
+ homepage: https://github.com/icoretech/omniauth-dropbox2
63
+ licenses:
64
+ - MIT
65
+ metadata:
66
+ source_code_uri: https://github.com/icoretech/omniauth-dropbox2
67
+ bug_tracker_uri: https://github.com/icoretech/omniauth-dropbox2/issues
68
+ changelog_uri: https://github.com/icoretech/omniauth-dropbox2/releases
69
+ rubygems_mfa_required: 'true'
48
70
  rdoc_options: []
49
71
  require_paths:
50
72
  - lib
@@ -52,16 +74,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
74
  requirements:
53
75
  - - ">="
54
76
  - !ruby/object:Gem::Version
55
- version: '0'
77
+ version: '3.2'
56
78
  required_rubygems_version: !ruby/object:Gem::Requirement
57
79
  requirements:
58
80
  - - ">="
59
81
  - !ruby/object:Gem::Version
60
82
  version: '0'
61
83
  requirements: []
62
- rubyforge_project:
63
- rubygems_version: 2.5.1
64
- signing_key:
84
+ rubygems_version: 3.6.9
65
85
  specification_version: 4
66
- summary: OmniAuth strategy for Dropbox using OAuth2
86
+ summary: OmniAuth strategy for Dropbox OAuth2 authentication.
67
87
  test_files: []
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in omniauth-dropbox2.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"