omniauth-artsy 0.1.1 → 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 +2 -1
- data/.rspec +1 -2
- data/.rubocop.yml +6 -0
- data/.rubocop_todo.yml +27 -17
- data/.travis.yml +8 -5
- data/CHANGELOG.md +25 -0
- data/Gemfile +2 -0
- data/README.md +11 -1
- data/Rakefile +3 -1
- data/lib/omniauth-artsy.rb +3 -0
- data/lib/omniauth-artsy/config.rb +35 -0
- data/lib/omniauth-artsy/version.rb +3 -1
- data/lib/omniauth/strategies/artsy.rb +16 -8
- data/omniauth-artsy.gemspec +31 -24
- metadata +19 -34
- data/spec/omniauth/strategies/artsy_spec.rb +0 -81
- data/spec/spec_helper.rb +0 -10
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,25 +1,35 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
#
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2020-09-11 17:57:36 UTC using RuboCop version 0.90.0.
|
3
4
|
# The point is for the user to remove these configuration records
|
4
5
|
# one by one as the offenses are removed from the code base.
|
5
6
|
# Note that changes in the inspected code, or installation of new
|
6
7
|
# versions of RuboCop, may require this file to be generated again.
|
7
8
|
|
8
|
-
# Offense count: 8
|
9
|
-
# Configuration parameters: AllowURI.
|
10
|
-
Metrics/LineLength:
|
11
|
-
Max: 154
|
12
|
-
|
13
9
|
# Offense count: 2
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
19
|
-
Style/Encoding:
|
20
|
-
Enabled: false
|
10
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
|
11
|
+
# ExcludedMethods: refine
|
12
|
+
Metrics/BlockLength:
|
13
|
+
Max: 67
|
21
14
|
|
22
15
|
# Offense count: 1
|
23
|
-
# Configuration parameters:
|
24
|
-
|
25
|
-
|
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'
|
21
|
+
|
22
|
+
# Offense count: 3
|
23
|
+
Style/Documentation:
|
24
|
+
Exclude:
|
25
|
+
- 'spec/**/*'
|
26
|
+
- 'test/**/*'
|
27
|
+
- 'lib/omniauth-artsy/config.rb'
|
28
|
+
- 'lib/omniauth/strategies/artsy.rb'
|
29
|
+
|
30
|
+
# Offense count: 3
|
31
|
+
# Cop supports --auto-correct.
|
32
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
33
|
+
# URISchemes: http, https
|
34
|
+
Layout/LineLength:
|
35
|
+
Max: 154
|
data/.travis.yml
CHANGED
@@ -3,15 +3,18 @@ language: ruby
|
|
3
3
|
cache: bundler
|
4
4
|
|
5
5
|
rvm:
|
6
|
-
- 2.
|
7
|
-
- 2.
|
8
|
-
-
|
9
|
-
-
|
10
|
-
- jruby-19mode
|
6
|
+
- 2.6.0
|
7
|
+
- 2.5.3
|
8
|
+
- 2.4.4
|
9
|
+
- jruby-9.2.5.0
|
11
10
|
- ruby-head
|
12
11
|
- jruby-head
|
13
12
|
|
14
13
|
matrix:
|
15
14
|
allow_failures:
|
16
15
|
- rvm: ruby-head
|
16
|
+
- rvm: jruby-9.2.5.0
|
17
17
|
- rvm: jruby-head
|
18
|
+
|
19
|
+
before_install:
|
20
|
+
- gem update bundler
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,28 @@
|
|
1
|
+
0.2.3 (Next)
|
2
|
+
===========
|
3
|
+
|
4
|
+
* Your contribution here.
|
5
|
+
|
6
|
+
0.2.3
|
7
|
+
============
|
8
|
+
|
9
|
+
* [#9](https://github.com/artsy/omniauth-artsy/pull/9): Upgrade `omniauth-oauth2` - [@ashkan18](https://github.com/ashkan18).
|
10
|
+
|
11
|
+
0.2.2
|
12
|
+
============
|
13
|
+
|
14
|
+
* [#7](https://github.com/artsy/omniauth-artsy/pull/7): Fix issue in configuring Artsy's strategy when using new config - [@ashkan18](https://github.com/ashkan18).
|
15
|
+
|
16
|
+
0.2.1
|
17
|
+
============
|
18
|
+
|
19
|
+
* [#6](https://github.com/artsy/omniauth-artsy/pull/6): Add config so we can configure/initialize `OmniAuth::Artsy` - [@ashkan18](https://github.com/ashkan18).
|
20
|
+
|
21
|
+
0.2.0 (5/4/2016)
|
22
|
+
================
|
23
|
+
|
24
|
+
* [#5](https://github.com/artsy/omniauth-artsy/pull/5): Obtain user details from APIv2 upon login - [@dblock](https://github.com/dblock).
|
25
|
+
|
1
26
|
0.1.1 (5/4/2016)
|
2
27
|
================
|
3
28
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -28,7 +28,17 @@ end
|
|
28
28
|
|
29
29
|
#### Configuration
|
30
30
|
|
31
|
-
|
31
|
+
##### Configure in your app
|
32
|
+
Add `omniauth_artsy.rb` to your `config/initializers` and set `artsy_api_url`.
|
33
|
+
```ruby
|
34
|
+
# config/initializers/omniauth_artsy.rb
|
35
|
+
OmniAuth::Artsy.configure do |config|
|
36
|
+
config.artsy_api_url = ENV['ARTSY_API_URL']
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
##### Using ENV
|
41
|
+
Set `ENV['ARTSY_API_URL']` to the location of the Artsy API, typically *https://api.artsy.net* in production.
|
32
42
|
|
33
43
|
### License
|
34
44
|
|
data/Rakefile
CHANGED
data/lib/omniauth-artsy.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Artsy
|
5
|
+
module Config
|
6
|
+
extend self
|
7
|
+
|
8
|
+
attr_accessor :artsy_api_url
|
9
|
+
|
10
|
+
def reset
|
11
|
+
self.artsy_api_url = nil
|
12
|
+
end
|
13
|
+
|
14
|
+
reset
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
def configure
|
19
|
+
if block_given?
|
20
|
+
yield(Config)
|
21
|
+
reconfigure_strategy
|
22
|
+
end
|
23
|
+
Config
|
24
|
+
end
|
25
|
+
|
26
|
+
def reconfigure_strategy
|
27
|
+
Strategies::Artsy.configure
|
28
|
+
end
|
29
|
+
|
30
|
+
def config
|
31
|
+
Config
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,17 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'omniauth-oauth2'
|
2
4
|
|
3
5
|
module OmniAuth
|
4
6
|
module Strategies
|
5
7
|
class Artsy < OmniAuth::Strategies::OAuth2
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
def self.configure
|
9
|
+
option :client_options,
|
10
|
+
site: OmniAuth::Artsy.config.artsy_api_url || ENV['ARTSY_API_URL'] || ENV['gravity_url'],
|
11
|
+
authorize_url: '/oauth2/authorize?scope=offline_access&response_type=code',
|
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=)
|
13
19
|
end
|
14
20
|
|
21
|
+
configure
|
22
|
+
|
15
23
|
uid do
|
16
24
|
raw_info['id']
|
17
25
|
end
|
@@ -21,7 +29,7 @@ module OmniAuth
|
|
21
29
|
end
|
22
30
|
|
23
31
|
def raw_info
|
24
|
-
@raw_info ||= access_token.get('/api/
|
32
|
+
@raw_info ||= access_token.get('/api/current_user', headers: { 'X-ACCESS-TOKEN' => access_token.token }).parsed
|
25
33
|
end
|
26
34
|
end
|
27
35
|
end
|
data/omniauth-artsy.gemspec
CHANGED
@@ -1,25 +1,32 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
Gem::Specification.new do |
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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'
|
25
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
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.1.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.1.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -66,23 +66,9 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
|
70
|
-
name: rubocop
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.25.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.25.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: []
|
@@ -98,16 +84,18 @@ files:
|
|
98
84
|
- README.md
|
99
85
|
- Rakefile
|
100
86
|
- lib/omniauth-artsy.rb
|
87
|
+
- lib/omniauth-artsy/config.rb
|
101
88
|
- lib/omniauth-artsy/version.rb
|
102
89
|
- lib/omniauth/strategies/artsy.rb
|
103
90
|
- omniauth-artsy.gemspec
|
104
|
-
- spec/omniauth/strategies/artsy_spec.rb
|
105
|
-
- spec/spec_helper.rb
|
106
91
|
homepage: https://github.com/artsy/omniauth-artsy
|
107
92
|
licenses:
|
108
93
|
- MIT
|
109
|
-
metadata:
|
110
|
-
|
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:
|
111
99
|
rdoc_options: []
|
112
100
|
require_paths:
|
113
101
|
- lib
|
@@ -115,18 +103,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
103
|
requirements:
|
116
104
|
- - ">="
|
117
105
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
106
|
+
version: 2.4.0
|
119
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
108
|
requirements:
|
121
109
|
- - ">="
|
122
110
|
- !ruby/object:Gem::Version
|
123
111
|
version: '0'
|
124
112
|
requirements: []
|
125
|
-
|
126
|
-
|
127
|
-
signing_key:
|
113
|
+
rubygems_version: 3.0.9
|
114
|
+
signing_key:
|
128
115
|
specification_version: 4
|
129
116
|
summary: Omniauth plugin for Artsy authentication.
|
130
|
-
test_files:
|
131
|
-
- spec/omniauth/strategies/artsy_spec.rb
|
132
|
-
- spec/spec_helper.rb
|
117
|
+
test_files: []
|
@@ -1,81 +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 'has correct Artsy API URL' do
|
26
|
-
expect(subject.options.client_options.site).to eq('http://localhost:3000')
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'has correct authorize url' do
|
30
|
-
expect(subject.options.client_options.authorize_url).to eq('/oauth2/authorize?scope=offline_access&response_type=code')
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'has correct token_url url' do
|
34
|
-
expect(subject.options.client_options.token_url).to eq('/oauth2/access_token?scope=offline_access&response_type=code&grant_type=authorization_code')
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'fetches raw_info' do
|
39
|
-
access_token = instance_double(OAuth2::AccessToken, token: 'secret')
|
40
|
-
allow(subject).to receive(:access_token).and_return(access_token)
|
41
|
-
|
42
|
-
response = instance_double(OAuth2::Response, parsed: @raw_info_hash)
|
43
|
-
expect(access_token).to receive(:get).with('/api/v1/me', headers: { 'X-ACCESS-TOKEN' => 'secret' }).and_return(response)
|
44
|
-
|
45
|
-
expect(subject.raw_info).to eq(@raw_info_hash)
|
46
|
-
end
|
47
|
-
|
48
|
-
describe 'with raw_info' do
|
49
|
-
before :each do
|
50
|
-
allow(subject).to receive(:raw_info) { @raw_info_hash }
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '#uid' do
|
54
|
-
it 'returns the uid from raw_info' do
|
55
|
-
expect(subject.uid).to eq(@uid)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe '#info' do
|
60
|
-
context 'when data is present in raw info' do
|
61
|
-
it 'returns the name' do
|
62
|
-
expect(subject.info[:raw_info]['name']).to eq(@name)
|
63
|
-
end
|
64
|
-
it 'returns the email' do
|
65
|
-
expect(subject.info[:raw_info]['email']).to eq(@email)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '#info' do
|
71
|
-
context 'when data is present in raw info' do
|
72
|
-
it 'returns the name' do
|
73
|
-
expect(subject.info[:raw_info]['name']).to eq(@name)
|
74
|
-
end
|
75
|
-
it 'returns the email' do
|
76
|
-
expect(subject.info[:raw_info]['email']).to eq(@email)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path('..', __FILE__)
|
2
|
-
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
3
|
-
|
4
|
-
require 'omniauth-artsy'
|
5
|
-
require 'rspec'
|
6
|
-
require 'webmock/rspec'
|
7
|
-
|
8
|
-
RSpec.configure do |config|
|
9
|
-
config.raise_errors_for_deprecations!
|
10
|
-
end
|