omniauth-dropbox-oauth2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c5ed11539bf046bda18750b3adeb8f65b59da216
4
+ data.tar.gz: fda41aa35547d48d381cc3f940fa13678963074c
5
+ SHA512:
6
+ metadata.gz: 82064f64501a029476602ab78cfb79fa4aa5ecfcee46e0cbc02a0edf1a0bb3acaecba2560c7a3d1dd2092fd82b86a89517e889e1834cd3456b68e84608f7f153
7
+ data.tar.gz: 370997d8cb09b2ac6390a9e90075724e6787c52c5bef2219ab5f0b055fa48b2743b7ff0e4ccf440195a45629a1b478f8c7d1655de55533533b745dfcf95bb466
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,54 @@
1
+ OmniAuth Dropbox OAuth2
2
+ =======================
3
+
4
+ Strategy to authenticate Dropbox in OmniAuth.
5
+
6
+ It's using the OAuth2 from the [Dropbox API](https://www.dropbox.com/developers)
7
+
8
+ Usage
9
+ -----
10
+
11
+ Add the strategy to your `Gemfile` alongside OmniAuth:
12
+
13
+ ```ruby
14
+ gem 'omniauth'
15
+ gem 'omniauth-dropbox-oauth2'
16
+ ```
17
+
18
+ Integrate this strategy to your OmniAuth middleware.
19
+
20
+ ```ruby
21
+ use OmniAuth::Builder do
22
+ provider :dropbox_oauth2, ENV['DROPBOX_KEY'], ENV['DROPBOX_SECRET']
23
+ end
24
+ ```
25
+
26
+ You need to add your key and secret.
27
+
28
+ Also remember to add the full callback path to your Dropbox App Console, for example: https://example.com/auth/dropbox-oauth2/callback
29
+
30
+ For more information check the [OmniAuth wiki](https://github.com/intridea/omniauth/wiki).
31
+
32
+ TODO
33
+ ----
34
+ This is a wip, so there are many things to do:
35
+ * Add tests (I did it really quick just to use on a personal project and no tests, shame on me)
36
+ * Test all cases (I'm not an expert with OAuth, so maybe there's something I'm missing)
37
+ * Make sure it's an OK gem (It's my first gem, I don't know exactly what I was supposed to do, so, please help me :D)
38
+
39
+ Helping
40
+ -------
41
+
42
+ * Fork the project, make your changes and send me a pull request.
43
+ * Create an issue! :D
44
+
45
+ License
46
+ -------
47
+
48
+ Copyright (c) 2013 Bernardo Amorim
49
+
50
+ 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:
51
+
52
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
53
+
54
+ 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.
@@ -0,0 +1 @@
1
+ require File.join('omniauth', 'dropbox_oauth2')
@@ -0,0 +1 @@
1
+ require File.join('omniauth', 'strategies', 'dropbox_oauth2')
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module DropboxOauth2
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,32 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class DropboxOauth2 < OmniAuth::Strategies::OAuth2
6
+ option :name, "dropbox_oauth2"
7
+ option :client_options, {
8
+ :site => 'https://api.dropbox.com',
9
+ :authorize_url => 'https://www.dropbox.com/1/oauth2/authorize',
10
+ :token_url => 'https://api.dropbox.com/1/oauth2/token'
11
+ }
12
+
13
+ uid { raw_info['uid'] }
14
+
15
+ info do
16
+ {
17
+ 'uid' => raw_info['uid'],
18
+ 'name' => raw_info['display_name'],
19
+ 'email' => raw_info['email']
20
+ }
21
+ end
22
+
23
+ extra do
24
+ { 'raw_info' => raw_info }
25
+ end
26
+
27
+ def raw_info
28
+ @raw_info ||= MultiJson.decode(access_token.get('/1/account/info').body)
29
+ end
30
+ end
31
+ end
32
+ end
data/lib/tasks/.keep ADDED
File without changes
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+ require File.expand_path(File.join('..', 'lib', 'omniauth', 'dropbox_oauth2', 'version'), __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = 'omniauth-dropbox-oauth2'
6
+ gem.version = OmniAuth::DropboxOauth2::VERSION
7
+ gem.homepage = 'https://github.com/bamorim/omniauth-dropbox-oauth2'
8
+
9
+ gem.author = "Bernardo Amorim"
10
+ gem.email = 'contato@bamorim.com'
11
+ gem.description = 'Dropbox OAuth2 strategy for OmniAuth 1.x'
12
+ gem.summary = gem.description
13
+
14
+ gem.license = "MIT"
15
+
16
+ gem.add_dependency "omniauth-oauth2"
17
+
18
+ gem.add_development_dependency 'rake'
19
+
20
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
21
+ gem.files = `git ls-files`.split("\n")
22
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
+
24
+ gem.require_paths = ['lib']
25
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-dropbox-oauth2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bernardo Amorim
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth-oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Dropbox OAuth2 strategy for OmniAuth 1.x
42
+ email: contato@bamorim.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - Gemfile
48
+ - README.md
49
+ - lib/omniauth-dropbox-oauth2.rb
50
+ - lib/omniauth/dropbox_oauth2.rb
51
+ - lib/omniauth/dropbox_oauth2/version.rb
52
+ - lib/omniauth/strategies/dropbox_oauth2.rb
53
+ - lib/tasks/.keep
54
+ - omniauth-dropbox-oauth2.gemspec
55
+ homepage: https://github.com/bamorim/omniauth-dropbox-oauth2
56
+ licenses:
57
+ - MIT
58
+ metadata: {}
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 2.0.3
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: Dropbox OAuth2 strategy for OmniAuth 1.x
79
+ test_files: []