omniauth-digitalocean 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/README.md +1 -1
- data/examples/sinatra/config.ru +18 -14
- data/lib/omniauth-digitalocean/version.rb +1 -1
- data/lib/omniauth/strategies/digitalocean.rb +10 -2
- data/spec/omniauth/strategies/digitalocean_spec.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1392de35285d7885830f50bf169e2982cba5acc2
|
4
|
+
data.tar.gz: cd023a08a1dbf6257f0815a93e874431b21e8a18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8c54ed63b31841d3e4f13cf2735def74c7a6dc9db84844d0fba1c6287efa5ae68a8ace336bebef0eaec53595c2926aa03747af8e1651f5daa6fa8bccb712c36
|
7
|
+
data.tar.gz: d30fe46823e69769910bf1d3459ae3342bef2efc9baede78c671ffd22e9732b23d9ac023cb3adffa61af7035b1ae6a010bbac363dcc99ef8c4231d68edead485
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -38,7 +38,7 @@ For additional information, refer to the [OmniAuth wiki](https://github.com/intr
|
|
38
38
|
|
39
39
|
See the [example](https://github.com/digitaloceancloud/omniauth-digitalocean/blob/master/examples/sinatra/config.ru) Sinatra app for full examples
|
40
40
|
|
41
|
-
Note: before running example app, please add your
|
41
|
+
Note: before running example app, please add your application id and secret to ` example/config.ru ` file.
|
42
42
|
|
43
43
|
## License
|
44
44
|
|
data/examples/sinatra/config.ru
CHANGED
@@ -3,22 +3,26 @@ require 'bundler/setup'
|
|
3
3
|
require 'sinatra'
|
4
4
|
require 'omniauth-digitalocean'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
end
|
6
|
+
class DigitalOceanExample < Sinatra::Base
|
7
|
+
use Rack::Session::Cookie
|
9
8
|
|
10
|
-
get '/
|
11
|
-
|
12
|
-
|
13
|
-
end
|
9
|
+
get '/' do
|
10
|
+
redirect '/auth/digitalocean'
|
11
|
+
end
|
14
12
|
|
15
|
-
get '/auth/
|
16
|
-
|
17
|
-
|
18
|
-
end
|
13
|
+
get '/auth/:provider/callback' do
|
14
|
+
content_type 'text/plain'
|
15
|
+
request.env['omniauth.auth'].to_hash.inspect rescue "No Data"
|
16
|
+
end
|
19
17
|
|
20
|
-
|
18
|
+
get '/auth/failure' do
|
19
|
+
content_type 'text/plain'
|
20
|
+
request.env['omniauth.auth'].to_hash.inspect rescue "No Data"
|
21
|
+
end
|
21
22
|
|
22
|
-
use OmniAuth::Builder do
|
23
|
-
|
23
|
+
use OmniAuth::Builder do
|
24
|
+
provider OmniAuth::Strategies::Digitalocean, ENV["DIGITALOCEAN_APP_ID"], ENV["DIGITALOCEAN_SECRET"], scope: "read write"
|
25
|
+
end
|
24
26
|
end
|
27
|
+
|
28
|
+
run DigitalOceanExample.run!
|
@@ -9,10 +9,10 @@ module OmniAuth
|
|
9
9
|
# use OmniAuth::Strategies::Digitalocean, 'consumerkey', 'consumersecret', :scope => 'read write', :display => 'plain'
|
10
10
|
#
|
11
11
|
class Digitalocean < OmniAuth::Strategies::OAuth2
|
12
|
-
AUTHENTICATION_PARAMETERS = %w(display state scope)
|
12
|
+
AUTHENTICATION_PARAMETERS = %w(display account state scope)
|
13
13
|
BASE_URL = "https://cloud.digitalocean.com"
|
14
14
|
|
15
|
-
option :name,
|
15
|
+
option :name, "digitalocean"
|
16
16
|
|
17
17
|
unless OmniAuth.config.test_mode
|
18
18
|
option :client_options, {
|
@@ -38,6 +38,14 @@ module OmniAuth
|
|
38
38
|
access_token.params['info']
|
39
39
|
end
|
40
40
|
|
41
|
+
# Over-ride callback_url definition to maintain
|
42
|
+
# compatability with omniauth-oauth2 >= 1.4.0
|
43
|
+
#
|
44
|
+
# See: https://github.com/intridea/omniauth-oauth2/issues/81
|
45
|
+
def callback_url
|
46
|
+
full_host + script_name + callback_path
|
47
|
+
end
|
48
|
+
|
41
49
|
# Hook useful for appending parameters into the auth url before sending
|
42
50
|
# to provider.
|
43
51
|
def request_phase
|
@@ -6,7 +6,7 @@ describe OmniAuth::Strategies::Digitalocean do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
describe "production client options" do
|
9
|
-
it { expect(subject.options.name).to eq(
|
9
|
+
it { expect(subject.options.name).to eq("digitalocean") }
|
10
10
|
|
11
11
|
it { expect(subject.options.client_options.site).to eq("https://cloud.digitalocean.com") }
|
12
12
|
it { expect(subject.options.client_options.authorize_url).to eq("https://cloud.digitalocean.com/v1/oauth/authorize") }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-digitalocean
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phillip Baker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
version: '0'
|
165
165
|
requirements: []
|
166
166
|
rubyforge_project:
|
167
|
-
rubygems_version: 2.4.
|
167
|
+
rubygems_version: 2.4.6
|
168
168
|
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: Official OmniAuth strategy for Digitalocean
|