omniauth-digitalocean 0.3.1 → 0.3.2

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
2
  SHA256:
3
- metadata.gz: 570bb5803a60b925bc0e4887acd7357ef6a06a5e99743d9bfad405ed89bc9ea4
4
- data.tar.gz: 7fd81e141f01263a8ecc20e1e962246bbb564be8f220dd8aa6630943aa55b41e
3
+ metadata.gz: b45abccf34e5f64011732e0e4bc3e561f0821761913645daaa6cc7b8f5df7446
4
+ data.tar.gz: b9837b5b7369fe9e658875cf97308238ee5daeaaed966eda8bec1024df2c80ae
5
5
  SHA512:
6
- metadata.gz: 393b6e6920c1ffe5a99a7768415edb2857d6a8b15f8bac34b511c34d8e6de47e75b31053b710f039cf44c90ea761c7736b7b496aaef115e9f1cf9fb9b07705f5
7
- data.tar.gz: cd004a7c54f78e04fe77e1083c1721c4acf67b028569ae6c7dcc14c0ee7ec77872874dadbea4b57ac7b1768efa84225a08783889ef9f88f477d3a51f9d0f08ae
6
+ metadata.gz: 864b58dd0082be7e73f58cae71db3507cbae47f15d936688dc6abd30c387161696820844bd4dd35ca67bc6a3604b26cce72909612aa5b1af30ea37f71705a9f5
7
+ data.tar.gz: cc7c71fa365f27b7e0acbb99931788c7142d09d7dac43d942ce25715c3f60ab803e16ead91e47831698f4206a13cdd7602a225fb4bd2539dd0662b0a21817ae3
@@ -12,25 +12,15 @@ jobs:
12
12
  fail-fast: true
13
13
  matrix:
14
14
  os: [ ubuntu-latest, macos-latest ]
15
- ruby: [ 2.5, 2.6, 2.7 ]
15
+ ruby: [ 2.5, 2.6, 2.7, '3.0' ]
16
16
  runs-on: ubuntu-latest
17
17
  steps:
18
- - uses: actions/checkout@v2
18
+ - uses: actions/checkout@v3
19
19
  - uses: ruby/setup-ruby@v1
20
20
  with:
21
21
  ruby-version: ${{ matrix.ruby }}
22
+ bundler-cache: true
22
23
 
23
- # Cache dependencies.
24
- - uses: actions/cache@v1
25
- with:
26
- path: vendor/bundle
27
- key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
28
- restore-keys: |
29
- bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-
30
- - name: Setup
31
- run: |
32
- gem install bundler
33
- bundle install --jobs 4 --retry 3
34
24
  - name: Test
35
25
  run: |
36
26
  bundle exec rspec ./spec
@@ -13,18 +13,11 @@ jobs:
13
13
  runs-on: ubuntu-latest
14
14
 
15
15
  steps:
16
- - uses: actions/checkout@v2
16
+ - uses: actions/checkout@v3
17
17
 
18
- - uses: actions/setup-ruby@v1
18
+ - uses: ruby/setup-ruby@v1
19
19
  with:
20
- ruby-version: 2.6
21
-
22
- - uses: actions/cache@v1
23
- with:
24
- path: vendor/bundle
25
- key: bundle-use-ruby-ubuntu-latest-2.6-${{ hashFiles('**/Gemfile.lock') }}
26
- restore-keys: |
27
- bundle-use-ruby-ubuntu-latest-2.6-
20
+ ruby-version: 2.7
28
21
 
29
22
  - name: Publish to RubyGems
30
23
  run: |
data/README.md CHANGED
@@ -32,13 +32,37 @@ Rails.application.config.middleware.use OmniAuth::Builder do
32
32
  end
33
33
  ```
34
34
 
35
- - The scope needs to be separated by space and not comma: "public redeploy" instead of "public,redeploy" !
35
+ - The scope needs to be separated by space and not comma: "read write" instead of "read,write" !
36
36
 
37
37
  For additional information, refer to the [OmniAuth wiki](https://github.com/intridea/omniauth/wiki).
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 application id and secret to ` example/config.ru ` file.
41
+ ## Auth Hash Schema
42
+
43
+ The following information is provided in the auth hash accessible to the callback at `request.env["omniauth.auth"]`:
44
+
45
+ * `provider` - The OmniAuth provider, i.e. `digitalocean`
46
+ * `uid` - The UUID of the authenticating user
47
+ * `info` - A hash containing information about the user
48
+ * `uuid` - The UUID of the authenticating user
49
+ * `name` - The user's display name
50
+ * `email` - The e-mail of the authenticating user
51
+ * `team_uuid` - The UUID of the team when authenticated in a team context
52
+ * `team_name` - The team's display name when authenticated in a team context
53
+ * `credentials` - A hash containing authentication information
54
+ * `token` - The DigitalOcean OAuth access token
55
+ * `refresh_token` - A refresh token that can be exchanged for a new OAuth access token
56
+ * `expires` - Boolean indicating whether the access token has an expiry date
57
+ * `expires_at` - Timestamp of the expiry time
58
+ * `extra` - Contains extra information returned from the `/v2/account` endpoint of the DigitalOcean API.
59
+ * `droplet_limit` - The total number of Droplets current user or team may have active at one time
60
+ * `floating_ip_limit` - The total number of Floating IPs the current user or team may have
61
+ * `email` - The email address for the current user
62
+ * `uuid` - The UUID for the current user.
63
+ * `email_verified` - If true, the user has verified their account via email
64
+ * `status` - This value is one of `active`, `warning`, or `locked`
65
+ * `status_message` - A human-readable message giving more details about the status of the account
42
66
 
43
67
  ## License
44
68
 
@@ -1,6 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'sinatra'
4
- gem 'omniauth'
4
+ gem 'omniauth', '~> 2.0'
5
5
  gem 'omniauth-digitalocean', :path => '../../'
6
6
  gem 'multi_json'
7
+ gem 'thin'
@@ -1,7 +1,17 @@
1
1
  # Sinatra Example
2
2
 
3
- How to use omniauth-digitalocean strategy with Sinatra.
3
+ A simple example of how to use `omniauth-digitalocean` strategy with Sinatra.
4
4
 
5
5
  ## Setup
6
6
 
7
- Create an application on http://cloud.digitalocean.com/settings/application and set the ENV variables DIGITALOCEAN_APP_ID and DIGITALOCEAN_SECRET.
7
+ Create an OAuth application in the [DigitalOcean control panel](https://cloud.digitalocean.com/account/api/applications).
8
+ The callback URL should be `http://127.0.0.1:4567/auth/digitalocean/callback`.
9
+
10
+ Next, set the environment variables `DIGITALOCEAN_APP_ID`
11
+ and `DIGITALOCEAN_SECRET` with the values from the control panel. Then run the
12
+ app with:
13
+
14
+ bundle install
15
+ bundle exec ruby config.ru
16
+
17
+ Now visit `http://127.0.0.1:4567` in the browser to login via DigitalOcean.
@@ -7,12 +7,22 @@ class DigitalOceanExample < Sinatra::Base
7
7
  use Rack::Session::Cookie
8
8
 
9
9
  get '/' do
10
- redirect '/auth/digitalocean'
10
+ <<~HTML
11
+ <form method='post' action='/auth/digitalocean'>
12
+ <input type="hidden" name="authenticity_token" value='#{request.env["rack.session"]["csrf"]}'>
13
+ <button type='submit'>Login with DigitalOcean</button>
14
+ </form>
15
+ HTML
11
16
  end
12
17
 
13
18
  get '/auth/:provider/callback' do
14
- content_type 'text/plain'
15
- request.env['omniauth.auth'].to_hash.inspect rescue "No Data"
19
+ auth = request.env["omniauth.auth"]
20
+ <<~HTML
21
+ <b>User:</b> #{auth['info']['name']}<br/>
22
+ <b>Team:</b> #{auth['info']['team_name']}<br/>
23
+ <b>Full response:</b><br/>
24
+ <pre>#{JSON.pretty_generate(auth)}</pre>
25
+ HTML
16
26
  end
17
27
 
18
28
  get '/auth/failure' do
@@ -19,13 +19,15 @@ module OmniAuth
19
19
  option :client_options, {
20
20
  :authorize_url => "#{BASE_URL}/v1/oauth/authorize",
21
21
  :token_url => "#{BASE_URL}/v1/oauth/token",
22
- :site => BASE_URL
22
+ :site => BASE_URL,
23
+ :auth_scheme => :request_body
23
24
  }
24
25
  else
25
26
  option :client_options, {
26
27
  :authorize_url => "http://localhost:3000/v1/oauth/authorize",
27
28
  :token_url => "http://localhost:3000/v1/oauth/token",
28
- :site => "http://localhost:3000"
29
+ :site => "http://localhost:3000",
30
+ :auth_scheme => :request_body
29
31
  }
30
32
  end
31
33
 
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Digitalocean
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_dependency "omniauth", "~> 2.0"
21
21
  spec.add_dependency "omniauth-oauth2", "~> 1.0"
22
+ spec.add_dependency "multi_json", '~> 1.15'
22
23
 
23
24
  spec.add_development_dependency "bundler", "~> 2.0"
24
25
  spec.add_development_dependency "rake"
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.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - DigitalOcean API Engineering team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-22 00:00:00.000000000 Z
11
+ date: 2023-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: multi_json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.15'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.15'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -164,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
178
  - !ruby/object:Gem::Version
165
179
  version: '0'
166
180
  requirements: []
167
- rubygems_version: 3.0.3.1
181
+ rubygems_version: 3.1.6
168
182
  signing_key:
169
183
  specification_version: 4
170
184
  summary: Official OmniAuth strategy for Digitalocean