omniauth-box2 2.0.2 → 2.0.4
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 +4 -4
- data/README.md +6 -4
- data/lib/omniauth/box2/version.rb +1 -1
- data/lib/omniauth/box2.rb +2 -2
- data/lib/omniauth/strategies/box.rb +24 -24
- data/lib/omniauth-box2/version.rb +1 -1
- data/lib/omniauth-box2.rb +1 -1
- data/omniauth-box2.gemspec +21 -21
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 603239a00945a15c9d54031fe5d7f433dab1a926cd1f9131dcb98e90ea779bcc
|
|
4
|
+
data.tar.gz: 8439bc56de8576408ee1f9f3660e3ad5016ce0f5c4cbdfb9a6735f228dcd8d0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aea00bb7b78f0dcdcff15b272fc3c417f5e9782b6d3be7b11746986abc04046b364822758f8615b78414999a95a53b72aa60029241162d5f17ecfb157bac8611
|
|
7
|
+
data.tar.gz: be69c1397a6d1fdc8a6fc686c8c3e9f55af58e07b1829289267295141fa247dfe6b9868fe6a58b217bcd8c7cfb078128d7944fa76921390d14ad8c35f6569d7d
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# OmniAuth
|
|
1
|
+
# OmniAuth Box Strategy
|
|
2
2
|
|
|
3
3
|
[](https://github.com/icoretech/omniauth-box2/actions/workflows/test.yml?query=branch%3Amain)
|
|
4
|
-
[](https://badge.fury.io/rb/omniauth-box2)
|
|
5
5
|
|
|
6
6
|
This gem provides an [OmniAuth](https://github.com/omniauth/omniauth) strategy for Box OAuth2.
|
|
7
7
|
|
|
@@ -79,6 +79,7 @@ Example payload from `request.env['omniauth.auth']` (real flow shape, anonymized
|
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
Notes:
|
|
82
|
+
|
|
82
83
|
- `uid` is mapped from `raw_info.id` (as string)
|
|
83
84
|
- `info.name` is mapped from `raw_info.name`
|
|
84
85
|
- `info.email` is mapped from `raw_info.login`
|
|
@@ -88,6 +89,7 @@ Notes:
|
|
|
88
89
|
## Provider Endpoints
|
|
89
90
|
|
|
90
91
|
The strategy uses current Box OAuth and API endpoints:
|
|
92
|
+
|
|
91
93
|
- Authorize URL: `https://account.box.com/api/oauth2/authorize`
|
|
92
94
|
- Token URL: `https://api.box.com/oauth2/token`
|
|
93
95
|
- User info URL: `https://api.box.com/2.0/users/me`
|
|
@@ -96,7 +98,7 @@ The strategy uses current Box OAuth and API endpoints:
|
|
|
96
98
|
|
|
97
99
|
```bash
|
|
98
100
|
bundle install
|
|
99
|
-
bundle exec
|
|
101
|
+
bundle exec standardrb --fix
|
|
100
102
|
bundle exec rake test_unit
|
|
101
103
|
bundle exec rake test_rails_integration
|
|
102
104
|
```
|
|
@@ -110,7 +112,7 @@ bundle exec rake test_rails_integration
|
|
|
110
112
|
## Compatibility
|
|
111
113
|
|
|
112
114
|
- Ruby: `>= 3.2` (tested on `3.2`, `3.3`, `3.4`, `4.0`)
|
|
113
|
-
- `omniauth-oauth2`: `>= 1.8`, `<
|
|
115
|
+
- `omniauth-oauth2`: `>= 1.8`, `< 2.0`
|
|
114
116
|
- Rails integration lanes: `~> 7.1.0`, `~> 7.2.0`, `~> 8.0.0`, `~> 8.1.0`
|
|
115
117
|
|
|
116
118
|
## Release
|
data/lib/omniauth/box2.rb
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
3
|
+
require "omniauth-oauth2"
|
|
4
4
|
|
|
5
5
|
module OmniAuth
|
|
6
6
|
module Strategies
|
|
7
7
|
# OmniAuth strategy for Box OAuth2.
|
|
8
8
|
class Box < OmniAuth::Strategies::OAuth2
|
|
9
|
-
option :name,
|
|
9
|
+
option :name, "box"
|
|
10
10
|
|
|
11
11
|
option :client_options,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
site: "https://api.box.com/2.0",
|
|
13
|
+
authorize_url: "https://account.box.com/api/oauth2/authorize",
|
|
14
|
+
token_url: "https://api.box.com/oauth2/token",
|
|
15
|
+
connection_opts: {
|
|
16
|
+
headers: {
|
|
17
|
+
user_agent: "icoretech-omniauth-box2 gem",
|
|
18
|
+
accept: "application/json",
|
|
19
|
+
content_type: "application/json"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
22
|
|
|
23
|
-
uid { raw_info[
|
|
23
|
+
uid { raw_info["id"].to_s }
|
|
24
24
|
|
|
25
25
|
info do
|
|
26
26
|
{
|
|
27
|
-
name: raw_info[
|
|
28
|
-
email: raw_info[
|
|
27
|
+
name: raw_info["name"],
|
|
28
|
+
email: raw_info["login"]
|
|
29
29
|
}.compact
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
credentials do
|
|
33
33
|
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
39
|
}.compact
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
extra do
|
|
43
43
|
{
|
|
44
|
-
|
|
44
|
+
"raw_info" => raw_info
|
|
45
45
|
}
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def raw_info
|
|
49
|
-
@raw_info ||= access_token.get(
|
|
49
|
+
@raw_info ||= access_token.get("users/me").parsed
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
# Ensure token exchange uses a stable callback URI that matches provider config.
|
|
@@ -56,7 +56,7 @@ module OmniAuth
|
|
|
56
56
|
|
|
57
57
|
# Prevent authorization response params from being appended to redirect_uri.
|
|
58
58
|
def query_string
|
|
59
|
-
return
|
|
59
|
+
return "" if request.params["code"]
|
|
60
60
|
|
|
61
61
|
super
|
|
62
62
|
end
|
|
@@ -65,7 +65,7 @@ module OmniAuth
|
|
|
65
65
|
|
|
66
66
|
def token_scope
|
|
67
67
|
token_params = access_token.respond_to?(:params) ? access_token.params : {}
|
|
68
|
-
token_params[
|
|
68
|
+
token_params["scope"] || (access_token["scope"] if access_token.respond_to?(:[]))
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
|
data/lib/omniauth-box2.rb
CHANGED
data/omniauth-box2.gemspec
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
lib = File.expand_path(
|
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
-
require
|
|
5
|
+
require "omniauth/box2/version"
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
|
-
spec.name =
|
|
8
|
+
spec.name = "omniauth-box2"
|
|
9
9
|
spec.version = OmniAuth::Box2::VERSION
|
|
10
|
-
spec.authors = [
|
|
11
|
-
spec.email = [
|
|
10
|
+
spec.authors = ["Claudio Poli"]
|
|
11
|
+
spec.email = ["masterkain@gmail.com"]
|
|
12
12
|
|
|
13
|
-
spec.summary =
|
|
14
|
-
spec.description =
|
|
15
|
-
spec.homepage =
|
|
16
|
-
spec.license =
|
|
17
|
-
spec.required_ruby_version =
|
|
13
|
+
spec.summary = "OmniAuth strategy for Box OAuth2 authentication."
|
|
14
|
+
spec.description = "OAuth2 strategy for OmniAuth that authenticates users with Box and exposes account metadata."
|
|
15
|
+
spec.homepage = "https://github.com/icoretech/omniauth-box2"
|
|
16
|
+
spec.license = "MIT"
|
|
17
|
+
spec.required_ruby_version = ">= 3.2"
|
|
18
18
|
|
|
19
|
-
spec.metadata[
|
|
20
|
-
spec.metadata[
|
|
21
|
-
spec.metadata[
|
|
22
|
-
spec.metadata[
|
|
19
|
+
spec.metadata["source_code_uri"] = "https://github.com/icoretech/omniauth-box2"
|
|
20
|
+
spec.metadata["bug_tracker_uri"] = "https://github.com/icoretech/omniauth-box2/issues"
|
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/icoretech/omniauth-box2/releases"
|
|
22
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
23
23
|
|
|
24
24
|
spec.files = Dir[
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
"lib/**/*.rb",
|
|
26
|
+
"README*",
|
|
27
|
+
"LICENSE*",
|
|
28
|
+
"*.gemspec"
|
|
29
29
|
]
|
|
30
|
-
spec.require_paths = [
|
|
30
|
+
spec.require_paths = ["lib"]
|
|
31
31
|
|
|
32
|
-
spec.add_dependency
|
|
33
|
-
spec.add_dependency
|
|
32
|
+
spec.add_dependency "cgi", ">= 0.3.6"
|
|
33
|
+
spec.add_dependency "omniauth-oauth2", ">= 1.8", "< 2.0"
|
|
34
34
|
end
|
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.
|
|
4
|
+
version: 2.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Claudio Poli
|
|
@@ -32,7 +32,7 @@ dependencies:
|
|
|
32
32
|
version: '1.8'
|
|
33
33
|
- - "<"
|
|
34
34
|
- !ruby/object:Gem::Version
|
|
35
|
-
version: '
|
|
35
|
+
version: '2.0'
|
|
36
36
|
type: :runtime
|
|
37
37
|
prerelease: false
|
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -42,7 +42,7 @@ dependencies:
|
|
|
42
42
|
version: '1.8'
|
|
43
43
|
- - "<"
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
|
-
version: '
|
|
45
|
+
version: '2.0'
|
|
46
46
|
description: OAuth2 strategy for OmniAuth that authenticates users with Box and exposes
|
|
47
47
|
account metadata.
|
|
48
48
|
email:
|