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 +5 -5
- data/.gitignore +1 -1
- data/.rspec +1 -2
- data/.rubocop.yml +6 -0
- data/.rubocop_todo.yml +14 -26
- data/.travis.yml +5 -5
- data/Gemfile +2 -0
- data/Rakefile +3 -1
- data/lib/omniauth-artsy.rb +2 -0
- data/lib/omniauth-artsy/config.rb +2 -0
- data/lib/omniauth-artsy/version.rb +3 -1
- data/lib/omniauth/strategies/artsy.rb +8 -4
- data/omniauth-artsy.gemspec +31 -23
- metadata +15 -33
- data/spec/lib/config_spec.rb +0 -18
- data/spec/omniauth/strategies/artsy_spec.rb +0 -84
- data/spec/spec_helper.rb +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 288c57c8e47b184a09c410179705501e5c09f4d0594f7278cef990d7842c12f3
|
|
4
|
+
data.tar.gz: 0acc42b621eb30cc637da2a8a55d002c7739dbbe4ac9cd7d8d9a49b0d2290268
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 656a8269b399888fbbd912bad9527bd694c0fa14af85e93eecd0cc5cbca6b45b1a738d21e07ccd13239946ab45aa80878318c4aa02735101c8d47bbd06e9c370
|
|
7
|
+
data.tar.gz: 759dee1cfa6c4c99e3bfc1129d7ac6cd6996756c86abf9fb5ebcb80bfcdfc04dad0aee3a1afd9933006eb61ea0c45c41c1a34726cb3e80f8c88d28431b6fae6c
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
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:
|
|
15
|
-
# Configuration parameters:
|
|
16
|
-
#
|
|
17
|
-
|
|
18
|
-
|
|
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:
|
|
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:
|
|
45
|
-
#
|
|
46
|
-
|
|
47
|
-
|
|
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.
|
|
7
|
-
- 2.
|
|
8
|
-
-
|
|
9
|
-
- jruby-
|
|
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
data/Rakefile
CHANGED
data/lib/omniauth-artsy.rb
CHANGED
|
@@ -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
|
data/omniauth-artsy.gemspec
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
8
|
-
autorequire:
|
|
7
|
+
- Artsy
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
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
|
-
|
|
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
|
-
-
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
128
|
-
|
|
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: []
|
data/spec/lib/config_spec.rb
DELETED
|
@@ -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
|