omniauth-globus 0.8.7 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7cfa88e79b566cff87e814f8af69380dc2473fa7ca9e66c443fe6cde1d30e824
4
- data.tar.gz: 11be01521bd7d5f5db73db1ad702bf198527c479d6a7e3bcde57139dc50763e8
3
+ metadata.gz: 456ad610a82e6dc94363def45d38967c3535dfe969e3c8f5cce783a9b8d9e5dc
4
+ data.tar.gz: 68b56ca539f3d5a5b7af8b870718975b9432dd7c1c2c81e67a54e7c60f155d19
5
5
  SHA512:
6
- metadata.gz: 9fe457d52d7509efbb253bbd76e89948502a3cdae387d870e491a2d4fe42f72626d590de9e69bac3aa298209dfd05de07efb34e8b07db48d26498c4dcb441769
7
- data.tar.gz: 96f098e039d385bceebacca23dbf8a87ba9e05351e973df11919cfc15c21dcc40d8bf39da4e96c2e4151d5df78dd64f26b776d47b6086d648ab245ff8b39dbf1
6
+ metadata.gz: dca8d521552579f8630dbf03bfcc93b27e98adc83c1212a3ab336caf6c292d7baf9758ea86722dae7b02aae3e6805340de1c2b54265a9702d1026ceff184ee7a
7
+ data.tar.gz: 247c8315f638c1a08ed7179ad33033feff1f2bfb11c63419abdc7ae391ec68f87e6a6cfd6809c5edf1cd8597ea62d8949038b8e57f621294bb1678f816b5965b
@@ -0,0 +1,37 @@
1
+ name: Build Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "master"
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ env:
11
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Set up Ruby 2.6
15
+ uses: actions/setup-ruby@v1
16
+ with:
17
+ ruby-version: 2.6.x
18
+
19
+ - name: Build and test
20
+ run: |
21
+ gem install bundler
22
+ bundle install
23
+ bundle exec rspec
24
+
25
+ - name: Publish code coverage
26
+ uses: paambaati/codeclimate-action@v2.7.4
27
+ env:
28
+ CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
29
+
30
+ - name: Notify Slack
31
+ uses: adamkdean/simple-slack-notify@1.0.4
32
+ with:
33
+ channel: '#ops'
34
+ username: 'GitHub Actions'
35
+ color: 'good'
36
+ text: 'A new version of the omniauth_globus gem has been built.'
37
+
@@ -0,0 +1,36 @@
1
+ name: Changelog
2
+
3
+ on:
4
+ pull_request:
5
+ types: [closed]
6
+
7
+ release:
8
+ types: [published]
9
+
10
+ issues:
11
+ types: [closed, edited]
12
+
13
+ jobs:
14
+ generate_changelog:
15
+ runs-on: ubuntu-latest
16
+ name: Generate changelog
17
+ steps:
18
+ - uses: actions/checkout@v1
19
+
20
+ - name: Generate changelog
21
+ uses: charmixer/auto-changelog-action@v1.1
22
+ with:
23
+ token: ${{ secrets.GITHUB_TOKEN }}
24
+
25
+ - name: Commit files
26
+ run: |
27
+ git config --local user.email "action@github.com"
28
+ git config --local user.name "GitHub Action"
29
+ git add CHANGELOG.md && git commit -m 'Updated CHANGELOG.md'
30
+
31
+ - name: Push changes
32
+ uses: ad-m/github-push-action@v0.6.0
33
+ with:
34
+ github_token: ${{ secrets.GITHUB_TOKEN }}
35
+ branch: 'refs/heads/master'
36
+ tags: false
@@ -0,0 +1,47 @@
1
+ name: Release Ruby Gem
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ env:
10
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - name: Set up Ruby 2.6
14
+ uses: actions/setup-ruby@v1
15
+ with:
16
+ ruby-version: 2.6.x
17
+
18
+ - name: Build and test
19
+ run: |
20
+ gem install bundler
21
+ bundle install
22
+ bundle exec rspec spec
23
+
24
+ - name: Code Climate Test Reporter
25
+ uses: aktions/codeclimate-test-reporter@v1
26
+ with:
27
+ codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
28
+ command: after-build
29
+
30
+ - name: Publish to RubyGems
31
+ run: |
32
+ mkdir -p $HOME/.gem
33
+ touch $HOME/.gem/credentials
34
+ chmod 0600 $HOME/.gem/credentials
35
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
36
+ gem build *.gemspec
37
+ gem push *.gem
38
+ env:
39
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
40
+
41
+ - name: Notify Slack
42
+ uses: adamkdean/simple-slack-notify@1.0.4
43
+ with:
44
+ channel: '#ops'
45
+ username: 'GitHub Actions'
46
+ color: 'good'
47
+ text: 'A new version of the omniauth_globus gem has been released.'
data/.rubocop.yml CHANGED
@@ -10,12 +10,6 @@ AllCops:
10
10
  Style/AndOr:
11
11
  Enabled: true
12
12
 
13
- # Do not use braces for hash literals when they are the last argument of a
14
- # method call.
15
- Style/BracesAroundHashParameters:
16
- Enabled: true
17
- EnforcedStyle: context_dependent
18
-
19
13
  # Align `when` with `case`.
20
14
  Layout/CaseIndentation:
21
15
  Enabled: true
@@ -52,7 +46,7 @@ Layout/EmptyLinesAroundMethodBody:
52
46
  Layout/EmptyLinesAroundModuleBody:
53
47
  Enabled: true
54
48
 
55
- Layout/IndentFirstArgument:
49
+ Layout/FirstArgumentIndentation:
56
50
  Enabled: true
57
51
 
58
52
  # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
@@ -144,11 +138,11 @@ Style/StringLiterals:
144
138
  EnforcedStyle: double_quotes
145
139
 
146
140
  # Detect hard tabs, no hard tabs.
147
- Layout/Tab:
141
+ Layout/IndentationStyle:
148
142
  Enabled: true
149
143
 
150
144
  # Blank lines should not have any spaces.
151
- Layout/TrailingBlankLines:
145
+ Layout/TrailingEmptyLines:
152
146
  Enabled: true
153
147
 
154
148
  # No trailing whitespace.
@@ -156,7 +150,7 @@ Layout/TrailingWhitespace:
156
150
  Enabled: true
157
151
 
158
152
  # Use quotes for string literals when they are enough.
159
- Style/UnneededPercentQ:
153
+ Style/RedundantPercentQ:
160
154
  Enabled: true
161
155
 
162
156
  Lint/AmbiguousOperator:
@@ -175,7 +169,7 @@ Lint/RequireParentheses:
175
169
  Lint/ShadowingOuterLocalVariable:
176
170
  Enabled: true
177
171
 
178
- Lint/StringConversionInInterpolation:
172
+ Lint/RedundantStringCoercion:
179
173
  Enabled: true
180
174
 
181
175
  Lint/UriEscapeUnescape:
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in omniauth-github.gemspec
4
6
  gemspec
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-globus (0.8.7)
4
+ omniauth-globus (0.9.1)
5
5
  jwt (~> 2.0)
6
- omniauth (~> 1.9)
6
+ omniauth (>= 1.9)
7
7
  omniauth-oauth2 (~> 1.6)
8
8
 
9
9
  GEM
@@ -11,72 +11,87 @@ GEM
11
11
  specs:
12
12
  addressable (2.7.0)
13
13
  public_suffix (>= 2.0.2, < 5.0)
14
- ast (2.4.0)
14
+ ast (2.4.2)
15
15
  codeclimate-test-reporter (1.0.9)
16
16
  simplecov (<= 0.13)
17
- crack (0.4.3)
18
- safe_yaml (~> 1.0.0)
19
- diff-lcs (1.3)
17
+ crack (0.4.5)
18
+ rexml
19
+ diff-lcs (1.4.4)
20
20
  docile (1.1.5)
21
- faraday (0.15.4)
21
+ faraday (1.4.1)
22
+ faraday-excon (~> 1.1)
23
+ faraday-net_http (~> 1.0)
24
+ faraday-net_http_persistent (~> 1.1)
22
25
  multipart-post (>= 1.2, < 3)
23
- hashdiff (1.0.0)
24
- hashie (3.6.0)
25
- jaro_winkler (1.5.3)
26
- json (2.2.0)
27
- jwt (2.2.1)
28
- multi_json (1.13.1)
26
+ ruby2_keywords (>= 0.0.4)
27
+ faraday-excon (1.1.0)
28
+ faraday-net_http (1.0.1)
29
+ faraday-net_http_persistent (1.1.0)
30
+ hashdiff (1.0.1)
31
+ hashie (4.1.0)
32
+ json (2.5.1)
33
+ jwt (2.2.3)
34
+ multi_json (1.15.0)
29
35
  multi_xml (0.6.0)
30
36
  multipart-post (2.1.1)
31
- oauth2 (1.4.1)
32
- faraday (>= 0.8, < 0.16.0)
37
+ oauth2 (1.4.7)
38
+ faraday (>= 0.8, < 2.0)
33
39
  jwt (>= 1.0, < 3.0)
34
40
  multi_json (~> 1.3)
35
41
  multi_xml (~> 0.5)
36
42
  rack (>= 1.2, < 3)
37
- omniauth (1.9.0)
38
- hashie (>= 3.4.6, < 3.7.0)
43
+ omniauth (2.0.4)
44
+ hashie (>= 3.4.6)
39
45
  rack (>= 1.6.2, < 3)
40
- omniauth-oauth2 (1.6.0)
41
- oauth2 (~> 1.1)
42
- omniauth (~> 1.9)
43
- parallel (1.17.0)
44
- parser (2.6.4.0)
45
- ast (~> 2.4.0)
46
- public_suffix (4.0.1)
47
- rack (2.0.7)
46
+ rack-protection
47
+ omniauth-oauth2 (1.7.1)
48
+ oauth2 (~> 1.4)
49
+ omniauth (>= 1.9, < 3)
50
+ parallel (1.20.1)
51
+ parser (3.0.1.1)
52
+ ast (~> 2.4.1)
53
+ public_suffix (4.0.6)
54
+ rack (2.2.3)
55
+ rack-protection (2.1.0)
56
+ rack
48
57
  rack-test (0.6.3)
49
58
  rack (>= 1.0)
50
59
  rainbow (3.0.0)
51
- rspec (3.8.0)
52
- rspec-core (~> 3.8.0)
53
- rspec-expectations (~> 3.8.0)
54
- rspec-mocks (~> 3.8.0)
55
- rspec-core (3.8.2)
56
- rspec-support (~> 3.8.0)
57
- rspec-expectations (3.8.4)
60
+ regexp_parser (2.1.1)
61
+ rexml (3.2.5)
62
+ rspec (3.10.0)
63
+ rspec-core (~> 3.10.0)
64
+ rspec-expectations (~> 3.10.0)
65
+ rspec-mocks (~> 3.10.0)
66
+ rspec-core (3.10.1)
67
+ rspec-support (~> 3.10.0)
68
+ rspec-expectations (3.10.1)
58
69
  diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.8.0)
60
- rspec-mocks (3.8.1)
70
+ rspec-support (~> 3.10.0)
71
+ rspec-mocks (3.10.2)
61
72
  diff-lcs (>= 1.2.0, < 2.0)
62
- rspec-support (~> 3.8.0)
63
- rspec-support (3.8.2)
64
- rubocop (0.74.0)
65
- jaro_winkler (~> 1.5.1)
73
+ rspec-support (~> 3.10.0)
74
+ rspec-support (3.10.2)
75
+ rubocop (0.93.1)
66
76
  parallel (~> 1.10)
67
- parser (>= 2.6)
77
+ parser (>= 2.7.1.5)
68
78
  rainbow (>= 2.2.2, < 4.0)
79
+ regexp_parser (>= 1.8)
80
+ rexml
81
+ rubocop-ast (>= 0.6.0)
69
82
  ruby-progressbar (~> 1.7)
70
- unicode-display_width (>= 1.4.0, < 1.7)
71
- ruby-progressbar (1.10.1)
72
- safe_yaml (1.0.5)
83
+ unicode-display_width (>= 1.4.0, < 2.0)
84
+ rubocop-ast (1.5.0)
85
+ parser (>= 3.0.1.1)
86
+ ruby-progressbar (1.11.0)
87
+ ruby2_keywords (0.0.4)
73
88
  simplecov (0.13.0)
74
89
  docile (~> 1.1.0)
75
90
  json (>= 1.8, < 3)
76
91
  simplecov-html (~> 0.10.0)
77
92
  simplecov-html (0.10.2)
78
- unicode-display_width (1.6.0)
79
- webmock (3.7.2)
93
+ unicode-display_width (1.7.0)
94
+ webmock (3.12.2)
80
95
  addressable (>= 2.3.6)
81
96
  crack (>= 0.3.2)
82
97
  hashdiff (>= 0.4.0, < 2.0.0)
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # omniauth-globus
2
2
 
3
+ [![Identifier](https://img.shields.io/badge/doi-10.14454%2F81gp--9y63-fca709.svg)](https://doi.org/10.14454/81gp-9y63)
3
4
  [![Gem Version](https://badge.fury.io/rb/omniauth-globus.svg)](https://badge.fury.io/rb/omniauth-globus)
4
5
  [![Build Status](https://travis-ci.com/datacite/omniauth-globus.svg?branch=master)](https://travis-ci.com/datacite/omniauth-globus)
5
6
  [![Test Coverage](https://api.codeclimate.com/v1/badges/13f9467872e9a688e9cb/test_coverage)](https://codeclimate.com/github/datacite/omniauth-globus/test_coverage)
data/codemeta.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "@context": "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld",
3
+ "@type": "SoftwareSourceCode",
4
+ "@id": "https://doi.org/10.14454/81gp-9y63",
5
+ "agents": {
6
+ "@id": "http://orcid.org/0000-0003-1419-2405",
7
+ "@type": "person",
8
+ "name": "Martin Fenner",
9
+ "affiliation": "DataCite",
10
+ "mustBeCited": true,
11
+ "isMaintainer": true,
12
+ "isRightsHolder": true
13
+ },
14
+ "identifier": "https://doi.org/10.14454/81gp-9y63",
15
+ "codeRepository": "https://github.com/datacite/omniauth-globus",
16
+ "controlledTem": "software",
17
+ "dateCreated": "2019-09-11",
18
+ "datePublished": "2019-09-11",
19
+ "dateModified": "2019-09-11",
20
+ "description": "Globus OAuth 2.0 Strategy for the OmniAuth Ruby authentication framework, with support for OpenID Connect. Provides basic support for authenticating a client application via the Globus service.",
21
+ "isAutomatedBuild": true,
22
+ "licenseId": "MIT",
23
+ "publisher": "DataCite",
24
+ "tags": [
25
+ "omniauth",
26
+ "devise",
27
+ "globus",
28
+ "openid connect",
29
+ "authentication"
30
+ ],
31
+ "title": "Omniauth-globus: authenticate a Ruby client application via OpenID Connect and the Globus service.",
32
+ "programmingLanguage": {
33
+ "name": "Ruby",
34
+ "version": "≥ 2.3.",
35
+ "URL": "https://www.ruby-lang.org"
36
+ },
37
+ "readme": "https://github.com/datacite/omniauth-globus/blob/master/README.md"
38
+ }
@@ -1 +1,3 @@
1
- require 'omniauth/globus'
1
+ # frozen_string_literal: true
2
+
3
+ require "omniauth/globus"
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'omniauth/strategies/globus'
3
+ require "omniauth/strategies/globus"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Globus
5
- VERSION = "0.8.7"
5
+ VERSION = "0.9.1"
6
6
  end
7
7
  end
@@ -12,9 +12,9 @@ module OmniAuth
12
12
  option :scope, "openid profile email"
13
13
  option :authorize_options, %i[access_type login_hint prompt request_visible_actions scope state redirect_uri include_granted_scopes openid_realm device_id device_name]
14
14
 
15
- option(:client_options, site: 'https://auth.globus.org',
16
- authorize_url: 'https://auth.globus.org/v2/oauth2/authorize',
17
- token_url: 'https://auth.globus.org/v2/oauth2/token',
15
+ option(:client_options, site: "https://auth.globus.org",
16
+ authorize_url: "https://auth.globus.org/v2/oauth2/authorize",
17
+ token_url: "https://auth.globus.org/v2/oauth2/token",
18
18
  discovery_endpoint: "https://auth.globus.org/.well-known/openid-configuration",
19
19
  authorization_endpoint: "https://auth.globus.org/v2/oauth2/authorize",
20
20
  token_endpoint: "https://auth.globus.org/v2/oauth2/token",
@@ -25,33 +25,33 @@ module OmniAuth
25
25
  def authorize_params
26
26
  super.tap do |params|
27
27
  options[:authorize_options].each do |k|
28
- params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
28
+ params[k] = request.params[k.to_s] unless [nil, ""].include?(request.params[k.to_s])
29
29
  end
30
30
 
31
31
  params[:scope] = get_scope(params)
32
- params[:access_type] = 'offline' if params[:access_type].nil?
33
- params['openid.realm'] = params.delete(:openid_realm) unless params[:openid_realm].nil?
32
+ params[:access_type] = "offline" if params[:access_type].nil?
33
+ params["openid.realm"] = params.delete(:openid_realm) unless params[:openid_realm].nil?
34
34
 
35
- session['omniauth.state'] = params[:state] if params[:state]
35
+ session["omniauth.state"] = params[:state] if params[:state]
36
36
  end
37
37
  end
38
38
 
39
- uid { raw_info['sub'] }
39
+ uid { raw_info["sub"] }
40
40
 
41
41
  info do
42
42
  prune!(
43
- name: raw_info['name'],
44
- first_name: raw_info['given_name'],
45
- last_name: raw_info['family_name'],
46
- email: raw_info['email']
43
+ name: raw_info["name"],
44
+ first_name: raw_info["given_name"],
45
+ last_name: raw_info["family_name"],
46
+ email: raw_info["email"]
47
47
  )
48
48
  end
49
49
 
50
50
  extra do
51
51
  hash = {}
52
- hash[:id_token] = access_token['id_token']
53
- if !access_token['id_token'].nil?
54
- decoded = ::JWT.decode(access_token['id_token'], nil, false).first
52
+ hash[:id_token] = access_token["id_token"]
53
+ if !access_token["id_token"].nil?
54
+ decoded = ::JWT.decode(access_token["id_token"], nil, false).first
55
55
 
56
56
  # We have to manually verify the claims because the third parameter to
57
57
  # JWT.decode is false since no verification key is provided.
@@ -78,77 +78,77 @@ module OmniAuth
78
78
 
79
79
  private
80
80
 
81
- def callback_url
82
- options[:redirect_uri] || (full_host + script_name + callback_path)
83
- end
81
+ def callback_url
82
+ options[:redirect_uri] || (full_host + script_name + callback_path)
83
+ end
84
84
 
85
- def get_access_token(request)
86
- verifier = request.params['code']
87
- redirect_uri = request.params['redirect_uri']
88
- if verifier && request.xhr?
89
- client_get_token(verifier, redirect_uri || 'postmessage')
90
- elsif verifier
91
- client_get_token(verifier, redirect_uri || callback_url)
92
- elsif verify_token(request.params['access_token'])
93
- ::OAuth2::AccessToken.from_hash(client, request.params.dup)
94
- elsif request.content_type =~ /json/i
95
- begin
96
- body = JSON.parse(request.body.read)
97
- request.body.rewind # rewind request body for downstream middlewares
98
- verifier = body && body['code']
99
- client_get_token(verifier, 'postmessage') if verifier
100
- rescue JSON::ParserError => e
101
- warn "[omniauth globus] JSON parse error=#{e}"
85
+ def get_access_token(request)
86
+ verifier = request.params["code"]
87
+ redirect_uri = request.params["redirect_uri"]
88
+ if verifier && request.xhr?
89
+ client_get_token(verifier, redirect_uri || "postmessage")
90
+ elsif verifier
91
+ client_get_token(verifier, redirect_uri || callback_url)
92
+ elsif verify_token(request.params["access_token"])
93
+ ::OAuth2::AccessToken.from_hash(client, request.params.dup)
94
+ elsif request.content_type =~ /json/i
95
+ begin
96
+ body = JSON.parse(request.body.read)
97
+ request.body.rewind # rewind request body for downstream middlewares
98
+ verifier = body && body["code"]
99
+ client_get_token(verifier, "postmessage") if verifier
100
+ rescue JSON::ParserError => e
101
+ warn "[omniauth globus] JSON parse error=#{e}"
102
+ end
102
103
  end
103
104
  end
104
- end
105
105
 
106
- def client_get_token(verifier, redirect_uri)
107
- client.auth_code.get_token(verifier, get_token_options(redirect_uri), get_token_params)
108
- end
106
+ def client_get_token(verifier, redirect_uri)
107
+ client.auth_code.get_token(verifier, get_token_options(redirect_uri), get_token_params)
108
+ end
109
109
 
110
- def get_token_params
111
- deep_symbolize(options.auth_token_params || {})
112
- end
110
+ def get_token_params
111
+ deep_symbolize(options.auth_token_params || {})
112
+ end
113
113
 
114
- def get_scope(params)
115
- raw_scope = params[:scope] || options.scope
116
- scope_list = raw_scope.split(" ").map { |item| item.split(",") }.flatten
117
- scope_list.join(" ")
118
- end
114
+ def get_scope(params)
115
+ raw_scope = params[:scope] || options.scope
116
+ scope_list = raw_scope.split(" ").map { |item| item.split(",") }.flatten
117
+ scope_list.join(" ")
118
+ end
119
119
 
120
- def get_token_options(redirect_uri = "")
121
- { redirect_uri: redirect_uri }.merge(token_params.to_hash(symbolize_keys: true))
122
- end
120
+ def get_token_options(redirect_uri = "")
121
+ { redirect_uri: redirect_uri }.merge(token_params.to_hash(symbolize_keys: true))
122
+ end
123
123
 
124
- def prune!(hash)
125
- hash.delete_if do |_, v|
126
- prune!(v) if v.is_a?(Hash)
127
- v.nil? || (v.respond_to?(:empty?) && v.empty?)
124
+ def prune!(hash)
125
+ hash.delete_if do |_, v|
126
+ prune!(v) if v.is_a?(Hash)
127
+ v.nil? || (v.respond_to?(:empty?) && v.empty?)
128
+ end
128
129
  end
129
- end
130
130
 
131
- def strip_unnecessary_query_parameters(query_parameters)
132
- # strip `sz` parameter (defaults to sz=50) which overrides `image_size` options
133
- return nil if query_parameters.nil?
131
+ def strip_unnecessary_query_parameters(query_parameters)
132
+ # strip `sz` parameter (defaults to sz=50) which overrides `image_size` options
133
+ return nil if query_parameters.nil?
134
134
 
135
- params = CGI.parse(query_parameters)
136
- stripped_params = params.delete_if { |key| key == 'sz' }
135
+ params = CGI.parse(query_parameters)
136
+ stripped_params = params.delete_if { |key| key == "sz" }
137
137
 
138
- # don't return an empty Hash since that would result
139
- # in URLs with a trailing ? character: http://image.url?
140
- return nil if stripped_params.empty?
138
+ # don't return an empty Hash since that would result
139
+ # in URLs with a trailing ? character: http://image.url?
140
+ return nil if stripped_params.empty?
141
141
 
142
- URI.encode_www_form(stripped_params)
143
- end
142
+ URI.encode_www_form(stripped_params)
143
+ end
144
144
 
145
- def verify_token(access_token)
146
- return false unless access_token
145
+ def verify_token(access_token)
146
+ return false unless access_token
147
147
 
148
- raw_response = client.request(:get, options.client_options.userinfo_endpoint,
149
- params: { access_token: access_token }).parsed
150
- raw_response["aud"] == options.client_id
151
- end
148
+ raw_response = client.request(:get, options.client_options.userinfo_endpoint,
149
+ params: { access_token: access_token }).parsed
150
+ raw_response["aud"] == options.client_id
151
+ end
152
152
  end
153
153
  end
154
154
  end