omniauth-dropbox2 1.0.5 → 2.0.1
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 +5 -5
- data/README.md +52 -15
- data/lib/omniauth/dropbox2/version.rb +7 -0
- data/lib/omniauth/dropbox2.rb +4 -0
- data/lib/omniauth/strategies/dropbox.rb +56 -0
- data/lib/omniauth-dropbox2/version.rb +3 -5
- data/lib/omniauth-dropbox2.rb +2 -58
- data/omniauth-dropbox2.gemspec +29 -16
- metadata +44 -24
- data/.gitignore +0 -17
- data/Gemfile +0 -4
- data/Rakefile +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 04676b895207720a6d857ce430158554de773436ffdf172ac2743a8329b059cb
|
|
4
|
+
data.tar.gz: 62f816ee5385c21b945d2c99add28a61dde724cfb171ab66062d8641ea5b4416
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f4ff99da40c42baeebcad1f36c36333c6b1431a7e119131507b0eff31fd1ec2992fb212fb422cc28243188b3f6bff7326caa57ccda836e9c3be72faabeff327
|
|
7
|
+
data.tar.gz: 9472344053ec88d0bbafc1f9260b39bd63aa99739e42185f52e7ef242168554e13f22b49c6f5bff68322f6cd4395b38ccddd9f6ecef48ec67e804c8398597078
|
data/README.md
CHANGED
|
@@ -1,29 +1,66 @@
|
|
|
1
|
-
# OmniAuth
|
|
1
|
+
# OmniAuth Dropbox2 Strategy
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'omniauth-dropbox2'
|
|
11
|
+
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Then run:
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
```bash
|
|
16
|
+
bundle install
|
|
17
|
+
```
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
## Usage
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
Configure OmniAuth in your Rack/Rails app:
|
|
18
22
|
|
|
19
|
-
|
|
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
|
-
|
|
62
|
+
Tag releases as `vX.Y.Z`; GitHub Actions publishes the gem to RubyGems.
|
|
22
63
|
|
|
23
|
-
##
|
|
64
|
+
## License
|
|
24
65
|
|
|
25
|
-
|
|
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,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
|
data/lib/omniauth-dropbox2.rb
CHANGED
|
@@ -1,59 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
40
|
-
def callback_url
|
|
41
|
-
# If redirect_uri is configured in token_params, use that
|
|
42
|
-
# value.
|
|
43
|
-
token_params.to_hash(symbolize_keys: true)[:redirect_uri] || super
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def query_string
|
|
47
|
-
# This method is called by callback_url, only if redirect_uri
|
|
48
|
-
# is omitted in token_params.
|
|
49
|
-
if request.params['code']
|
|
50
|
-
# If this is a callback, ignore query parameters added by
|
|
51
|
-
# the provider.
|
|
52
|
-
''
|
|
53
|
-
else
|
|
54
|
-
super
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
3
|
+
require 'omniauth/dropbox2'
|
data/omniauth-dropbox2.gemspec
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
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
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
spec.files = Dir[
|
|
25
|
+
'lib/**/*.rb',
|
|
26
|
+
'README*',
|
|
27
|
+
'LICENSE*',
|
|
28
|
+
'*.gemspec'
|
|
29
|
+
]
|
|
30
|
+
spec.require_paths = ['lib']
|
|
19
31
|
|
|
20
|
-
|
|
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:
|
|
4
|
+
version: 2.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Claudio Poli
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
13
|
+
name: cgi
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
|
-
- - "
|
|
16
|
+
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
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:
|
|
27
|
-
|
|
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
|
-
-
|
|
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/
|
|
45
|
-
licenses:
|
|
46
|
-
|
|
47
|
-
|
|
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: '
|
|
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
|
-
|
|
63
|
-
rubygems_version: 2.6.11
|
|
64
|
-
signing_key:
|
|
84
|
+
rubygems_version: 3.6.9
|
|
65
85
|
specification_version: 4
|
|
66
|
-
summary: OmniAuth strategy for Dropbox
|
|
86
|
+
summary: OmniAuth strategy for Dropbox OAuth2 authentication.
|
|
67
87
|
test_files: []
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require "bundler/gem_tasks"
|