omniauth-roblox 0.0.1 → 0.0.3

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: 0bf2f52cc783b6a23260c21901b9404ea3efc4564b3a8f8331a299501ff0c7c1
4
- data.tar.gz: b51116d747e5362dcbacd427c3ac0b7097b07bd0d6868c0ee5fe5e8fb3796e1c
3
+ metadata.gz: 2ec3d5c9661ea76aa87c1966cbcc91ec1de7aa28f8fb4cfbb8aa3d645c08b9b7
4
+ data.tar.gz: 5c171cd33bdd360051e49724418bed1eb431b0d56ff7994896176ae4b3122e90
5
5
  SHA512:
6
- metadata.gz: f82761ea7895efc0cfaee69e4996446749d05a4e72a2140478ab5f10005566912ea04455a5f717a0ace28aec35d62afe64b8a8d5bd932aefebb9600f37c4a630
7
- data.tar.gz: 3b5bb51b61a4828433cdd5d7b1c30ea4d33858773486fede900c326aa4656d82b86d04d6aea27c707206e4d6d8014cf2d709dad2e73e435a4b77cc6a2aa2cfb2
6
+ metadata.gz: 85e4ff0f7547db4b04d96154b9e6430f47b5715a43a5e62008846d1ff5ff962cae1a491960213b181ccd02266a6bd44747b03634e6b8d0dfc760bf5df494b39e
7
+ data.tar.gz: b6e7f4e2a59447dd0bc14c5baaa489fb637fb6ffb25935ee816f9c77c445b2ad450d8d1b78d7cb49bb4158c141a4ef79c2abbc94ea91c877b9ba8a75cdb4ba95
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
6
-
7
- gem 'rake', group: 'development'
8
- gem 'rubocop', '~> 1.36', group: 'development'
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ gem 'rake', group: 'development'
8
+ gem 'rubocop', '~> 1.36', group: 'development'
data/Gemfile.lock CHANGED
@@ -1,74 +1,74 @@
1
- PATH
2
- remote: .
3
- specs:
4
- omniauth-roblox (0.0.1)
5
- jwt (~> 2.5)
6
- omniauth (~> 2.1)
7
- omniauth-oauth2 (~> 1.8)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- ast (2.4.2)
13
- faraday (2.5.2)
14
- faraday-net_http (>= 2.0, < 3.1)
15
- ruby2_keywords (>= 0.0.4)
16
- faraday-net_http (3.0.0)
17
- hashie (5.0.0)
18
- json (2.6.2)
19
- jwt (2.5.0)
20
- multi_xml (0.6.0)
21
- oauth2 (2.0.8)
22
- faraday (>= 0.17.3, < 3.0)
23
- jwt (>= 1.0, < 3.0)
24
- multi_xml (~> 0.5)
25
- rack (>= 1.2, < 3)
26
- snaky_hash (~> 2.0)
27
- version_gem (~> 1.1)
28
- omniauth (2.1.0)
29
- hashie (>= 3.4.6)
30
- rack (>= 2.2.3)
31
- rack-protection
32
- omniauth-oauth2 (1.8.0)
33
- oauth2 (>= 1.4, < 3)
34
- omniauth (~> 2.0)
35
- parallel (1.22.1)
36
- parser (3.1.2.1)
37
- ast (~> 2.4.1)
38
- rack (2.2.4)
39
- rack-protection (2.2.2)
40
- rack
41
- rainbow (3.1.1)
42
- rake (13.0.6)
43
- regexp_parser (2.5.0)
44
- rexml (3.2.5)
45
- rubocop (1.36.0)
46
- json (~> 2.3)
47
- parallel (~> 1.10)
48
- parser (>= 3.1.2.1)
49
- rainbow (>= 2.2.2, < 4.0)
50
- regexp_parser (>= 1.8, < 3.0)
51
- rexml (>= 3.2.5, < 4.0)
52
- rubocop-ast (>= 1.20.1, < 2.0)
53
- ruby-progressbar (~> 1.7)
54
- unicode-display_width (>= 1.4.0, < 3.0)
55
- rubocop-ast (1.21.0)
56
- parser (>= 3.1.1.0)
57
- ruby-progressbar (1.11.0)
58
- ruby2_keywords (0.0.5)
59
- snaky_hash (2.0.0)
60
- hashie
61
- version_gem (~> 1.1)
62
- unicode-display_width (2.2.0)
63
- version_gem (1.1.0)
64
-
65
- PLATFORMS
66
- x86_64-linux
67
-
68
- DEPENDENCIES
69
- omniauth-roblox!
70
- rake
71
- rubocop (~> 1.36)
72
-
73
- BUNDLED WITH
74
- 2.3.21
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-roblox (0.0.1)
5
+ jwt (~> 2.5)
6
+ omniauth (~> 2.1)
7
+ omniauth-oauth2 (~> 1.8)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ ast (2.4.2)
13
+ faraday (2.5.2)
14
+ faraday-net_http (>= 2.0, < 3.1)
15
+ ruby2_keywords (>= 0.0.4)
16
+ faraday-net_http (3.0.0)
17
+ hashie (5.0.0)
18
+ json (2.6.2)
19
+ jwt (2.5.0)
20
+ multi_xml (0.6.0)
21
+ oauth2 (2.0.8)
22
+ faraday (>= 0.17.3, < 3.0)
23
+ jwt (>= 1.0, < 3.0)
24
+ multi_xml (~> 0.5)
25
+ rack (>= 1.2, < 3)
26
+ snaky_hash (~> 2.0)
27
+ version_gem (~> 1.1)
28
+ omniauth (2.1.0)
29
+ hashie (>= 3.4.6)
30
+ rack (>= 2.2.3)
31
+ rack-protection
32
+ omniauth-oauth2 (1.8.0)
33
+ oauth2 (>= 1.4, < 3)
34
+ omniauth (~> 2.0)
35
+ parallel (1.22.1)
36
+ parser (3.1.2.1)
37
+ ast (~> 2.4.1)
38
+ rack (2.2.4)
39
+ rack-protection (2.2.2)
40
+ rack
41
+ rainbow (3.1.1)
42
+ rake (13.0.6)
43
+ regexp_parser (2.5.0)
44
+ rexml (3.2.5)
45
+ rubocop (1.36.0)
46
+ json (~> 2.3)
47
+ parallel (~> 1.10)
48
+ parser (>= 3.1.2.1)
49
+ rainbow (>= 2.2.2, < 4.0)
50
+ regexp_parser (>= 1.8, < 3.0)
51
+ rexml (>= 3.2.5, < 4.0)
52
+ rubocop-ast (>= 1.20.1, < 2.0)
53
+ ruby-progressbar (~> 1.7)
54
+ unicode-display_width (>= 1.4.0, < 3.0)
55
+ rubocop-ast (1.21.0)
56
+ parser (>= 3.1.1.0)
57
+ ruby-progressbar (1.11.0)
58
+ ruby2_keywords (0.0.5)
59
+ snaky_hash (2.0.0)
60
+ hashie
61
+ version_gem (~> 1.1)
62
+ unicode-display_width (2.2.0)
63
+ version_gem (1.1.0)
64
+
65
+ PLATFORMS
66
+ x86_64-linux
67
+
68
+ DEPENDENCIES
69
+ omniauth-roblox!
70
+ rake
71
+ rubocop (~> 1.36)
72
+
73
+ BUNDLED WITH
74
+ 2.3.21
data/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Wolftallemo
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Wolftallemo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # OmniAuth Roblox
2
+ OmniAuth strategy for Roblox
3
+
4
+ ## Installation
5
+ Add to your `Gemfile`
6
+ ```
7
+ gem 'omniauth-roblox'
8
+ ```
9
+ Run `bundle install`
10
+
11
+ ## Setup
12
+ ⚠️ Roblox's OAuth API is currently private access only ⚠️
13
+
14
+ - Go to https://create.roblox.com/credentials
15
+ - Fill out the fields and select your scopes
16
+
17
+ ## Usage
18
+ An example of adding this middleware to your Rails app in `config/initializers/omniauth.rb`
19
+ ```rb
20
+ Rails.application.config.middleware.use OmniAuth::Builder do
21
+ provider :roblox, ENV['RBX_CLIENT_ID'], ENV['RBX_CLIENT_SECRET']
22
+ end
23
+ ```
24
+
25
+ ## Configuration Options
26
+ - `scope`: No scopes are currently set by default, Roblox requires the `openid` scope at the minimum.
27
+ - `image_type`: The type of image that should be returned by roblox, defaults to `headshot`. Allowed values: `[empty string]` (full body), `bust`, and `headshot`.
28
+ - `jwt_leeway`: Amount of leeway in seconds passed to the JWT library, only works with version 2.1 or earlier.
29
+ - `skip_image`: If this is set to `true`, no image url will be returned.
@@ -1,99 +1,98 @@
1
- # frozen_string_literal: true
2
-
3
- require 'json'
4
- require 'jwt'
5
- require 'net/http'
6
- require 'omniauth/strategies/oauth2'
7
- require 'uri'
8
-
9
- module OmniAuth
10
- module Strategies
11
- # This is the Roblox OAuth/OIDC strategy
12
- # Currently their API is in private beta
13
- # If you are enrolled, you may register
14
- # at https://create.roblox.com/credentials
15
- class Roblox < OmniAuth::Strategies::OAuth2
16
- option :name, 'roblox'
17
-
18
- option :client_options,
19
- authorize_url: 'https://authorize.roblox.com/',
20
- site: 'https://apis.roblox.com/oauth',
21
- token_url: 'v1/token'
22
-
23
- option :jwt_leeway, 60
24
- option :authorize_options, %i[consent login selectAccount]
25
- option :image_type, 'headshot'
26
- option :skip_image, false
27
-
28
- def authorize_params # rubocop:disable Metrics/AbcSize
29
- super.tap do |params|
30
- options[:authorize_options].each do |k|
31
- params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
32
- end
33
-
34
- session['omniauth.state'] = params[:state] if params[:state]
35
- end
36
- end
37
-
38
- uid { raw_info['sub'] }
39
-
40
- info do
41
- {
42
- name: raw_info['name'],
43
- email: "#{SecureRandom.hex(18)}@notre.al",
44
- nickname: user_info['nickname'],
45
- image: image_url,
46
- # This is provided in the `profile` claim, but is not included if the `profile` scope is not set
47
- urls: { website: "https://www.roblox.com/users/#{uid}/profile" }
48
- }
49
- end
50
-
51
- extra do
52
- { raw_info: raw_info }
53
- end
54
-
55
- def raw_info
56
- @raw_info ||= ::JWT.decode(access_token['id_token'], nil, false).first
57
-
58
- return if @raw_info['name']
59
-
60
- user_api_res = Net::HTTP.get_response(URI("https://users.roblox.com/v1/users/#{uid}"))
61
-
62
- # The Roblox Users API returns usernames under the `name` property
63
- # Unlike the id_token where it is the display name
64
- return unless user_api_res.is_a?(Net::HTTPSuccess)
65
-
66
- api_data = JSON.parse(user_api_res.body)
67
- @raw_info['nickname'] = api_data['name']
68
- @raw_info['name'] = api_data['displayName']
69
- end
70
-
71
- # Roblox currently does not allow third parties to access user emails, this is only added for completeness
72
- def verified_email
73
- raw_info['email_verified'] ? raw_info['email'] : nil
74
- end
75
-
76
- def image_url # rubocop:disable Metrics
77
- return nil if options[:skip_image]
78
-
79
- url = 'https://thumbnails.roblox.com/v1/users/avatar'
80
- url_additions = {
81
- bust: '-bust',
82
- headshot: '-headshot'
83
- }
84
- uri = URI(url + url_additions[options[:image_type]])
85
- uri.query = URI.encode_www_form({
86
- userIds: raw_info['sub'],
87
- size: '720x720',
88
- format: 'Png',
89
- isCircular: 'false'
90
- })
91
-
92
- res = Net::HTTP.get_response(uri)
93
- data = JSON.parse(res.body).data.first
94
-
95
- res.is_a?(Net::HTTPSuccess) ? data.imageUrl : nil
96
- end
97
- end
98
- end
99
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'jwt'
5
+ require 'net/http'
6
+ require 'omniauth/strategies/oauth2'
7
+ require 'uri'
8
+
9
+ module OmniAuth
10
+ module Strategies
11
+ # This is the Roblox OAuth/OIDC strategy
12
+ # Currently their API is in private beta
13
+ # If you are enrolled, you may register
14
+ # at https://create.roblox.com/credentials
15
+ class Roblox < OmniAuth::Strategies::OAuth2
16
+ option :name, 'roblox'
17
+
18
+ option :client_options,
19
+ authorize_url: 'v1/authorize',
20
+ site: 'https://apis.roblox.com/oauth',
21
+ token_url: 'v1/token'
22
+
23
+ option :jwt_leeway, 60
24
+ option :authorize_options, %i[consent login selectAccount]
25
+ option :image_type, 'headshot'
26
+ option :skip_image, false
27
+
28
+ def authorize_params # rubocop:disable Metrics/AbcSize
29
+ super.tap do |params|
30
+ options[:authorize_options].each do |k|
31
+ params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
32
+ end
33
+
34
+ session['omniauth.state'] = params[:state] if params[:state]
35
+ end
36
+ end
37
+
38
+ uid { raw_info['sub'] }
39
+
40
+ info do
41
+ {
42
+ name: raw_info['name'],
43
+ nickname: user_info['nickname'],
44
+ image: image_url,
45
+ # This is provided in the `profile` claim, but is not included if the `profile` scope is not set
46
+ urls: { website: "https://www.roblox.com/users/#{uid}/profile" }
47
+ }
48
+ end
49
+
50
+ extra do
51
+ { raw_info: raw_info }
52
+ end
53
+
54
+ def raw_info
55
+ @raw_info ||= ::JWT.decode(access_token['id_token'], nil, false).first
56
+
57
+ return if @raw_info['name']
58
+
59
+ user_api_res = Net::HTTP.get_response(URI("https://users.roblox.com/v1/users/#{uid}"))
60
+
61
+ # The Roblox Users API returns usernames under the `name` property
62
+ # Unlike the id_token where it is the display name
63
+ return unless user_api_res.is_a?(Net::HTTPSuccess)
64
+
65
+ api_data = JSON.parse(user_api_res.body)
66
+ @raw_info['nickname'] = api_data['name']
67
+ @raw_info['name'] = api_data['displayName']
68
+ end
69
+
70
+ # Roblox currently does not allow third parties to access user emails, this is only added for completeness
71
+ def verified_email
72
+ raw_info['email_verified'] ? raw_info['email'] : nil
73
+ end
74
+
75
+ def image_url # rubocop:disable Metrics
76
+ return nil if options[:skip_image]
77
+
78
+ url = 'https://thumbnails.roblox.com/v1/users/avatar'
79
+ url_additions = {
80
+ bust: '-bust',
81
+ headshot: '-headshot'
82
+ }
83
+ uri = URI(url + url_additions[options[:image_type]])
84
+ uri.query = URI.encode_www_form({
85
+ userIds: raw_info['sub'],
86
+ size: '720x720',
87
+ format: 'Png',
88
+ isCircular: 'false'
89
+ })
90
+
91
+ res = Net::HTTP.get_response(uri)
92
+ data = JSON.parse(res.body).data.first
93
+
94
+ res.is_a?(Net::HTTPSuccess) ? data.imageUrl : nil
95
+ end
96
+ end
97
+ end
98
+ end
@@ -1,5 +1,5 @@
1
- module OmniAuth
2
- module Roblox
3
- VERSION = '0.0.1'
4
- end
5
- end
1
+ module OmniAuth
2
+ module Roblox
3
+ VERSION = '0.0.3'
4
+ end
5
+ end
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: true
2
-
3
- require 'omniauth-roblox/version'
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth-roblox/version'
4
4
  require 'omniauth/strategies/roblox'
@@ -1,18 +1,18 @@
1
- # frozen_string_literal: true
2
-
3
- require File.expand_path('lib/omniauth-roblox/version', __dir__)
4
-
5
- Gem::Specification.new do |gem|
6
- gem.authors = ['Wolftallemo']
7
- gem.files = `git ls-files`.split("\n")
8
- gem.homepage = 'https://github.com/Wolftallemo/omniauth-roblox'
9
- gem.license = 'MIT'
10
- gem.name = 'omniauth-roblox'
11
- gem.required_ruby_version = '>= 2.7.2'
12
- gem.summary = 'OmniAuth strategy for Roblox'
13
- gem.version = OmniAuth::Roblox::VERSION
14
-
15
- gem.add_dependency 'jwt', '~> 2.5'
16
- gem.add_dependency 'omniauth', '~> 2.1'
17
- gem.add_dependency 'omniauth-oauth2', '~> 1.8'
18
- end
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('lib/omniauth-roblox/version', __dir__)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.authors = ['Wolftallemo']
7
+ gem.files = `git ls-files`.split("\n")
8
+ gem.homepage = 'https://github.com/Wolftallemo/omniauth-roblox'
9
+ gem.license = 'MIT'
10
+ gem.name = 'omniauth-roblox'
11
+ gem.required_ruby_version = '>= 2.7.2'
12
+ gem.summary = 'OmniAuth strategy for Roblox'
13
+ gem.version = OmniAuth::Roblox::VERSION
14
+
15
+ gem.add_dependency 'jwt', '~> 2.5'
16
+ gem.add_dependency 'omniauth', '~> 2.1'
17
+ gem.add_dependency 'omniauth-oauth2', '~> 1.8'
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-roblox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wolftallemo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-08 00:00:00.000000000 Z
11
+ date: 2022-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -52,8 +52,8 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.8'
55
- description:
56
- email:
55
+ description:
56
+ email:
57
57
  executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
@@ -61,6 +61,7 @@ files:
61
61
  - Gemfile
62
62
  - Gemfile.lock
63
63
  - LICENSE
64
+ - README.md
64
65
  - Rakefile
65
66
  - lib/omniauth-roblox.rb
66
67
  - lib/omniauth-roblox/omniauth/strategies/roblox.rb
@@ -70,7 +71,7 @@ homepage: https://github.com/Wolftallemo/omniauth-roblox
70
71
  licenses:
71
72
  - MIT
72
73
  metadata: {}
73
- post_install_message:
74
+ post_install_message:
74
75
  rdoc_options: []
75
76
  require_paths:
76
77
  - lib
@@ -85,8 +86,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
86
  - !ruby/object:Gem::Version
86
87
  version: '0'
87
88
  requirements: []
88
- rubygems_version: 3.3.22
89
- signing_key:
89
+ rubygems_version: 3.3.7
90
+ signing_key:
90
91
  specification_version: 4
91
92
  summary: OmniAuth strategy for Roblox
92
93
  test_files: []