omniauth-box2 2.0.1 → 2.0.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: 1681f74e62caa96e65e15d9f6832ab8c4b703d9d27d820ab126bb3f433f69ec2
4
- data.tar.gz: a294ab333dbf19ede72114d6b7fdbe59be9cdf27e842d3f50c09b66f5bfdbce5
3
+ metadata.gz: 13b53739996442e474da313ee85714c9d0f651056172ac03cf02dd1e7066c3ef
4
+ data.tar.gz: 3918f1934f2aadcdedc351a7134b1945ae92af801a0fbc93856b648c267bbffd
5
5
  SHA512:
6
- metadata.gz: e68f7e2cc8cfb255b4c90a22d2030a4e9a33e239035f9b59d762799892a796e7a062c866097e8df90e8a36e748496201d137d922109baa693e74b3aec29b7c9e
7
- data.tar.gz: 6ac68e16746151212e3e7303000c0129946d05da6089ade90f02461781618cc2e286a066f9acee8903051f849e152199e2025d615f081523340bfd7511652a09
6
+ metadata.gz: c3cdc133bdcdf37edf5d8dfe1d55026ff42cd2972355f7b44e132b30c3ff9e4c5495e10c723e9c4236b97ac44dba1cb23a22dac447c61797393a1509adcb47c7
7
+ data.tar.gz: 1c52a1ef2117776d5b031647bae8271b367a950597d26aa142e046ad22aee5b9bff805b20ecc7354585035d08bdfa2f6156b305961bbcde376623ce3b8dbeaf6
data/README.md CHANGED
@@ -27,6 +27,16 @@ Rails.application.config.middleware.use OmniAuth::Builder do
27
27
  end
28
28
  ```
29
29
 
30
+ ## Provider App Setup
31
+
32
+ - Box developer console: <https://developer.box.com/>
33
+ - Register callback URL (example): `https://your-app.example.com/auth/box/callback`
34
+
35
+ ## Options
36
+
37
+ - `callback_url`
38
+ - Request-phase query options can be passed directly to `/auth/box` when supported by Box OAuth endpoints.
39
+
30
40
  ## Auth Hash
31
41
 
32
42
  Example payload from `request.env['omniauth.auth']` (real flow shape, anonymized):
@@ -38,6 +48,12 @@ Example payload from `request.env['omniauth.auth']` (real flow shape, anonymized
38
48
  "name": "Sample User",
39
49
  "email": "sample@example.test"
40
50
  },
51
+ "credentials": {
52
+ "token": "sample-access-token",
53
+ "refresh_token": "sample-refresh-token",
54
+ "expires": false,
55
+ "scope": "root_readonly"
56
+ },
41
57
  "extra": {
42
58
  "raw_info": {
43
59
  "type": "user",
@@ -66,6 +82,7 @@ Notes:
66
82
  - `uid` is mapped from `raw_info.id` (as string)
67
83
  - `info.name` is mapped from `raw_info.name`
68
84
  - `info.email` is mapped from `raw_info.login`
85
+ - `credentials` includes `token`, plus `refresh_token` when provided by Box
69
86
  - `extra.raw_info` is the full `users/me` response
70
87
 
71
88
  ## Provider Endpoints
@@ -84,6 +101,22 @@ bundle exec rake test_unit
84
101
  bundle exec rake test_rails_integration
85
102
  ```
86
103
 
104
+ ## Test Structure
105
+
106
+ - `test/omniauth_box2_test.rb`: strategy/unit behavior
107
+ - `test/rails_integration_test.rb`: full Rack/Rails request+callback flow
108
+ - `test/test_helper.rb`: shared test bootstrap
109
+
110
+ ## Compatibility
111
+
112
+ - Ruby: `>= 3.2` (tested on `3.2`, `3.3`, `3.4`, `4.0`)
113
+ - `omniauth-oauth2`: `>= 1.8`, `< 1.9`
114
+ - Rails integration lanes: `~> 7.1.0`, `~> 7.2.0`, `~> 8.0.0`, `~> 8.1.0`
115
+
116
+ ## Release
117
+
118
+ Tag releases as `vX.Y.Z`; GitHub Actions publishes the gem to RubyGems.
119
+
87
120
  ## License
88
121
 
89
122
  MIT License. See `LICENSE.txt`.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Box2
5
- VERSION = '2.0.1'
5
+ VERSION = '2.0.2'
6
6
  end
7
7
  end
@@ -29,6 +29,16 @@ module OmniAuth
29
29
  }.compact
30
30
  end
31
31
 
32
+ credentials do
33
+ {
34
+ 'token' => access_token.token,
35
+ 'refresh_token' => access_token.refresh_token,
36
+ 'expires_at' => access_token.expires_at,
37
+ 'expires' => access_token.expires?,
38
+ 'scope' => token_scope
39
+ }.compact
40
+ end
41
+
32
42
  extra do
33
43
  {
34
44
  'raw_info' => raw_info
@@ -50,6 +60,13 @@ module OmniAuth
50
60
 
51
61
  super
52
62
  end
63
+
64
+ private
65
+
66
+ def token_scope
67
+ token_params = access_token.respond_to?(:params) ? access_token.params : {}
68
+ token_params['scope'] || (access_token['scope'] if access_token.respond_to?(:[]))
69
+ end
53
70
  end
54
71
 
55
72
  Box2 = Box
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-box2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Poli