omniauth-artsy 0.2.3 → 0.3.0

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
- SHA1:
3
- metadata.gz: 15d23f5b99553dd48c01bb24fcf4c6687d44db3b
4
- data.tar.gz: 34f42bb7bcfc043a0d4ee22761b7f7c36759cfc9
2
+ SHA256:
3
+ metadata.gz: 288c57c8e47b184a09c410179705501e5c09f4d0594f7278cef990d7842c12f3
4
+ data.tar.gz: 0acc42b621eb30cc637da2a8a55d002c7739dbbe4ac9cd7d8d9a49b0d2290268
5
5
  SHA512:
6
- metadata.gz: 3ebed18a95a73622fb93da0b159eb151d97fb1b450ffb5558f6c4e2d2f57bb02e7d7c0b7a5290452e2e42ea7c902366bbfafa040f6b2d40669686fd992b951aa
7
- data.tar.gz: 98090a7a6cefec8129ec7a181279b4a68d3601733450d9baea5816675e3f88238c7bd43027cc0e2661043ddaaeaba0c4fed7162fd6692a13c4f26ececb6fd157
6
+ metadata.gz: 656a8269b399888fbbd912bad9527bd694c0fa14af85e93eecd0cc5cbca6b45b1a738d21e07ccd13239946ab45aa80878318c4aa02735101c8d47bbd06e9c370
7
+ data.tar.gz: 759dee1cfa6c4c99e3bfc1129d7ac6cd6996756c86abf9fb5ebcb80bfcdfc04dad0aee3a1afd9933006eb61ea0c45c41c1a34726cb3e80f8c88d28431b6fae6c
data/.gitignore CHANGED
@@ -1,4 +1,4 @@
1
1
  Gemfile.lock
2
2
  .bundle
3
3
  pkg
4
-
4
+ .rspec_status
data/.rspec CHANGED
@@ -1,3 +1,2 @@
1
1
  --color
2
- --format documentation
3
-
2
+ --order random
data/.rubocop.yml CHANGED
@@ -1 +1,7 @@
1
1
  inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ NewCops: enable
5
+
6
+ Style/ModuleFunction:
7
+ Enabled: false
data/.rubocop_todo.yml CHANGED
@@ -1,21 +1,23 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-03-31 17:08:47 -0400 using RuboCop version 0.48.0.
3
+ # on 2020-09-11 17:57:36 UTC using RuboCop version 0.90.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  # Offense count: 2
10
- # Configuration parameters: CountComments, ExcludedMethods.
10
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
11
+ # ExcludedMethods: refine
11
12
  Metrics/BlockLength:
12
13
  Max: 67
13
14
 
14
- # Offense count: 8
15
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
16
- # URISchemes: http, https
17
- Metrics/LineLength:
18
- Max: 154
15
+ # Offense count: 1
16
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, Regex, IgnoreExecutableScripts, AllowedAcronyms.
17
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
18
+ Naming/FileName:
19
+ Exclude:
20
+ - 'lib/omniauth-artsy.rb'
19
21
 
20
22
  # Offense count: 3
21
23
  Style/Documentation:
@@ -25,23 +27,9 @@ Style/Documentation:
25
27
  - 'lib/omniauth-artsy/config.rb'
26
28
  - 'lib/omniauth/strategies/artsy.rb'
27
29
 
28
- # Offense count: 1
29
- # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
30
- # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
31
- Style/FileName:
32
- Exclude:
33
- - 'lib/omniauth-artsy.rb'
34
-
35
- # Offense count: 1
36
- # Configuration parameters: EnforcedStyle, SupportedStyles.
37
- # SupportedStyles: module_function, extend_self
38
- Style/ModuleFunction:
39
- Exclude:
40
- - 'lib/omniauth-artsy/config.rb'
41
-
42
- # Offense count: 1
30
+ # Offense count: 3
43
31
  # Cop supports --auto-correct.
44
- # Configuration parameters: SupportedStyles.
45
- # SupportedStyles: percent, brackets
46
- Style/SymbolArray:
47
- EnforcedStyle: brackets
32
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
33
+ # URISchemes: http, https
34
+ Layout/LineLength:
35
+ Max: 154
data/.travis.yml CHANGED
@@ -3,17 +3,17 @@ language: ruby
3
3
  cache: bundler
4
4
 
5
5
  rvm:
6
- - 2.3.0
7
- - 2.2
8
- - rbx-2
9
- - jruby-19mode
6
+ - 2.6.0
7
+ - 2.5.3
8
+ - 2.4.4
9
+ - jruby-9.2.5.0
10
10
  - ruby-head
11
11
  - jruby-head
12
12
 
13
13
  matrix:
14
14
  allow_failures:
15
- - rvm: rbx-2
16
15
  - rvm: ruby-head
16
+ - rvm: jruby-9.2.5.0
17
17
  - rvm: jruby-head
18
18
 
19
19
  before_install:
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler'
2
4
  Bundler::GemHelper.install_tasks
3
5
 
@@ -9,4 +11,4 @@ end
9
11
  require 'rubocop/rake_task'
10
12
  RuboCop::RakeTask.new(:rubocop)
11
13
 
12
- task default: [:rubocop, :spec]
14
+ task default: %i[rubocop spec]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'omniauth-artsy/version'
2
4
  require 'omniauth-artsy/config'
3
5
  require 'omniauth/strategies/artsy'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OmniAuth
2
4
  module Artsy
3
5
  module Config
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Omniauth
2
4
  module Artsy
3
- VERSION = '0.2.3'.freeze
5
+ VERSION = '0.3.0'
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'omniauth-oauth2'
2
4
 
3
5
  module OmniAuth
@@ -8,14 +10,16 @@ module OmniAuth
8
10
  site: OmniAuth::Artsy.config.artsy_api_url || ENV['ARTSY_API_URL'] || ENV['gravity_url'],
9
11
  authorize_url: '/oauth2/authorize?scope=offline_access&response_type=code',
10
12
  token_url: '/oauth2/access_token?scope=offline_access&response_type=code&grant_type=authorization_code'
13
+ # TODO: Allow GET requests to redirect to /auth/artsy for now, which exposes us
14
+ # to CSRF attacks. We'll want to change the auth redirect behavior to a POST
15
+ # request at some point in the future.
16
+ # https://github.com/omniauth/omniauth/wiki/Resolving-CVE-2015-9284
17
+ OmniAuth.config.allowed_request_methods = %i[post get] if OmniAuth.config.respond_to?(:allowed_request_methods=)
18
+ OmniAuth.config.silence_get_warning = true if OmniAuth.config.respond_to?(:silence_get_warning=)
11
19
  end
12
20
 
13
21
  configure
14
22
 
15
- def request_phase
16
- super
17
- end
18
-
19
23
  uid do
20
24
  raw_info['id']
21
25
  end
@@ -1,24 +1,32 @@
1
- $LOAD_PATH.push File.expand_path('lib', __dir__)
2
- require 'omniauth-artsy/version'
3
-
4
- Gem::Specification.new do |s|
5
- s.name = 'omniauth-artsy'
6
- s.version = Omniauth::Artsy::VERSION
7
- s.platform = Gem::Platform::RUBY
8
- s.authors = ['Dylan Fareed']
9
- s.email = ['dylan@artsy.net']
10
- s.homepage = 'https://github.com/artsy/omniauth-artsy'
11
- s.summary = 'Omniauth plugin for Artsy authentication. '
12
- s.description = 'Omniauth plugin for Artsy authentication. '
13
- s.files = `git ls-files`.split("\n")
14
- s.test_files = `git ls-files -- spec/*`.split("\n")
15
- s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
16
- s.require_paths = ['lib']
17
- s.license = 'MIT'
18
-
19
- s.add_runtime_dependency 'omniauth-oauth2', '>= 1.1.2'
20
- s.add_development_dependency 'rake'
21
- s.add_development_dependency 'rspec'
22
- s.add_development_dependency 'rubocop'
23
- s.add_development_dependency 'webmock'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/omniauth-artsy/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'omniauth-artsy'
7
+ spec.version = Omniauth::Artsy::VERSION
8
+ spec.authors = ['Artsy']
9
+ spec.email = ['dev@artsy.net']
10
+
11
+ spec.summary = 'Omniauth plugin for Artsy authentication.'
12
+ spec.description = 'Omniauth plugin for Artsy authentication.'
13
+ spec.homepage = 'https://github.com/artsy/omniauth-artsy'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = spec.homepage
19
+ spec.metadata['changelog_uri'] = 'https://github.com/artsy/omniauth-artsy/blob/master/CHANGELOG.md'
20
+
21
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
+ end
24
+
25
+ spec.require_paths = ['lib']
26
+
27
+ spec.add_runtime_dependency 'omniauth-oauth2', '>= 1.1.2'
28
+
29
+ spec.add_development_dependency 'rake'
30
+ spec.add_development_dependency 'rspec'
31
+ spec.add_development_dependency 'rubocop'
24
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-artsy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - Dylan Fareed
8
- autorequire:
7
+ - Artsy
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-25 00:00:00.000000000 Z
11
+ date: 2021-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -66,23 +66,9 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: webmock
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- description: 'Omniauth plugin for Artsy authentication. '
69
+ description: Omniauth plugin for Artsy authentication.
84
70
  email:
85
- - dylan@artsy.net
71
+ - dev@artsy.net
86
72
  executables: []
87
73
  extensions: []
88
74
  extra_rdoc_files: []
@@ -102,14 +88,14 @@ files:
102
88
  - lib/omniauth-artsy/version.rb
103
89
  - lib/omniauth/strategies/artsy.rb
104
90
  - omniauth-artsy.gemspec
105
- - spec/lib/config_spec.rb
106
- - spec/omniauth/strategies/artsy_spec.rb
107
- - spec/spec_helper.rb
108
91
  homepage: https://github.com/artsy/omniauth-artsy
109
92
  licenses:
110
93
  - MIT
111
- metadata: {}
112
- post_install_message:
94
+ metadata:
95
+ homepage_uri: https://github.com/artsy/omniauth-artsy
96
+ source_code_uri: https://github.com/artsy/omniauth-artsy
97
+ changelog_uri: https://github.com/artsy/omniauth-artsy/blob/master/CHANGELOG.md
98
+ post_install_message:
113
99
  rdoc_options: []
114
100
  require_paths:
115
101
  - lib
@@ -117,19 +103,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
103
  requirements:
118
104
  - - ">="
119
105
  - !ruby/object:Gem::Version
120
- version: '0'
106
+ version: 2.4.0
121
107
  required_rubygems_version: !ruby/object:Gem::Requirement
122
108
  requirements:
123
109
  - - ">="
124
110
  - !ruby/object:Gem::Version
125
111
  version: '0'
126
112
  requirements: []
127
- rubyforge_project:
128
- rubygems_version: 2.4.8
129
- signing_key:
113
+ rubygems_version: 3.0.9
114
+ signing_key:
130
115
  specification_version: 4
131
116
  summary: Omniauth plugin for Artsy authentication.
132
- test_files:
133
- - spec/lib/config_spec.rb
134
- - spec/omniauth/strategies/artsy_spec.rb
135
- - spec/spec_helper.rb
117
+ test_files: []
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe OmniAuth::Artsy::Config do
4
- describe '#configure' do
5
- before do
6
- expect(OmniAuth::Artsy).to receive(:reconfigure_strategy).once
7
- OmniAuth::Artsy.configure do |config|
8
- config.artsy_api_url = 'http://localhost:3000/api'
9
- end
10
- end
11
- after do
12
- OmniAuth::Artsy.config.reset
13
- end
14
- it 'sets token' do
15
- expect(OmniAuth::Artsy.config.artsy_api_url).to eq 'http://localhost:3000/api'
16
- end
17
- end
18
- end
@@ -1,84 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe OmniAuth::Strategies::Artsy do
4
- before :each do
5
- @request = double('Request')
6
- allow(@request).to receive(:params) { {} }
7
-
8
- @client_id = '912831askljfd2'
9
- @client_secret = 'dfallksdfoads'
10
- @domain = 'artsy.net'
11
- @uid = 'asdfasdfadsfcdad'
12
- @name = 'Bobert Smithson'
13
- @email = 'email@spiraljeezey.com'
14
-
15
- @raw_info_hash = { 'id' => @uid, 'name' => @name, 'email' => @email }
16
- end
17
-
18
- subject do
19
- OmniAuth::Strategies::Artsy.new(nil, @options || {}).tap do |strategy|
20
- allow(strategy).to receive(:request) { @request }
21
- end
22
- end
23
-
24
- describe '#client_options' do
25
- it 'returns correct url for Artsy API URL when it was set' do
26
- OmniAuth::Artsy.configure do |config|
27
- config.artsy_api_url = 'http://api.test.url'
28
- end
29
- expect(subject.options.client_options.site).to eq 'http://api.test.url'
30
- end
31
-
32
- it 'has correct authorize url' do
33
- expect(subject.options.client_options.authorize_url).to eq('/oauth2/authorize?scope=offline_access&response_type=code')
34
- end
35
-
36
- it 'has correct token_url url' do
37
- expect(subject.options.client_options.token_url).to eq('/oauth2/access_token?scope=offline_access&response_type=code&grant_type=authorization_code')
38
- end
39
- end
40
-
41
- it 'fetches raw_info' do
42
- access_token = instance_double(OAuth2::AccessToken, token: 'secret')
43
- allow(subject).to receive(:access_token).and_return(access_token)
44
-
45
- response = instance_double(OAuth2::Response, parsed: @raw_info_hash)
46
- expect(access_token).to receive(:get).with('/api/current_user', headers: { 'X-ACCESS-TOKEN' => 'secret' }).and_return(response)
47
-
48
- expect(subject.raw_info).to eq(@raw_info_hash)
49
- end
50
-
51
- describe 'with raw_info' do
52
- before :each do
53
- allow(subject).to receive(:raw_info) { @raw_info_hash }
54
- end
55
-
56
- describe '#uid' do
57
- it 'returns the uid from raw_info' do
58
- expect(subject.uid).to eq(@uid)
59
- end
60
- end
61
-
62
- describe '#info' do
63
- context 'when data is present in raw info' do
64
- it 'returns the name' do
65
- expect(subject.info[:raw_info]['name']).to eq(@name)
66
- end
67
- it 'returns the email' do
68
- expect(subject.info[:raw_info]['email']).to eq(@email)
69
- end
70
- end
71
- end
72
-
73
- describe '#info' do
74
- context 'when data is present in raw info' do
75
- it 'returns the name' do
76
- expect(subject.info[:raw_info]['name']).to eq(@name)
77
- end
78
- it 'returns the email' do
79
- expect(subject.info[:raw_info]['email']).to eq(@email)
80
- end
81
- end
82
- end
83
- end
84
- end
data/spec/spec_helper.rb DELETED
@@ -1,8 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path(__dir__)
2
- $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
3
-
4
- require 'omniauth-artsy'
5
- require 'rspec'
6
- require 'webmock/rspec'
7
-
8
- RSpec.configure(&:raise_errors_for_deprecations!)