omniauth-vkontakte 1.4.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +22 -0
- data/.rubocop.yml +16 -0
- data/Gemfile +6 -4
- data/LICENSE +21 -0
- data/README.md +14 -28
- data/examples/Gemfile +4 -2
- data/examples/config.ru +2 -0
- data/examples/main.rb +6 -6
- data/lib/omniauth-vkontakte.rb +7 -3
- data/lib/omniauth/strategies/vkontakte.rb +38 -32
- data/lib/omniauth/vkontakte/version.rb +7 -0
- data/omniauth-vkontakte.gemspec +13 -11
- data/spec/omniauth/strategies/vkontakte_spec.rb +22 -18
- data/spec/spec_helper.rb +5 -5
- metadata +24 -19
- data/.travis.yml +0 -10
- data/Rakefile +0 -9
- data/lib/omniauth-vkontakte/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c31336de0c0d1630c1b24a9970d46503353a3d31a81be62dc9b0e5d3b910d9e8
|
4
|
+
data.tar.gz: 4d0e103aef7cd9593cf8e37e69c54c35a64a94a0b3f6c999d39d11d5a11cfcfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 375f8caec707839dabce173adb21c63c7d9fee36852bf9e6412f1b463d1c0e520bc10810f9f0384799992abe8ffce007399001b22328a98cf8e1fb3ee211aa9f
|
7
|
+
data.tar.gz: 0daa0d710c5a061bdf7019aa6224e0cf718f9473e8f1f2397bfa068efd9208dd296ab726242b4722f2d1d11168c3a0a85096a50fea098807c284e745c983ced2
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: [2.5, 2.6, 2.7, 3.0, head, jruby, jruby-head]
|
11
|
+
os: [ubuntu-latest, macos-latest]
|
12
|
+
runs-on: ${{ matrix.os }}
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@master
|
15
|
+
- name: Set up Ruby
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby }}
|
19
|
+
- name: Install dependencies
|
20
|
+
run: bundle install
|
21
|
+
- name: Run test
|
22
|
+
run: rspec
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
TargetRubyVersion: 2.5
|
4
|
+
Layout/LineLength:
|
5
|
+
Max: 120
|
6
|
+
Metrics/MethodLength:
|
7
|
+
Enabled: false
|
8
|
+
Metrics/BlockLength:
|
9
|
+
Enabled: false
|
10
|
+
Metrics/ClassLength:
|
11
|
+
Max: 101
|
12
|
+
Lint/DuplicateBranch:
|
13
|
+
Enabled: false
|
14
|
+
Naming/FileName:
|
15
|
+
Exclude:
|
16
|
+
- 'lib/omniauth-vkontakte.rb'
|
data/Gemfile
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
gemspec
|
4
6
|
|
5
|
-
|
6
|
-
gem '
|
7
|
+
group :development do
|
8
|
+
gem 'rubocop', require: false
|
9
|
+
end
|
7
10
|
|
8
11
|
group :test do
|
9
|
-
gem 'rspec'
|
10
|
-
gem 'rack-test'
|
12
|
+
gem 'rspec'
|
11
13
|
gem 'simplecov'
|
12
14
|
gem 'webmock'
|
13
15
|
end
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2011-2021 Anton Maminov
|
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
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# OmniAuth VKontakte
|
2
2
|
|
3
|
-
|
3
|
+
![Ruby](https://github.com/mamantoha/omniauth-vkontakte/workflows/Ruby/badge.svg)
|
4
|
+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/149c0614deef469faa49e1e8ae384bd3)](https://app.codacy.com/app/mamantoha/omniauth-vkontakte?utm_source=github.com&utm_medium=referral&utm_content=mamantoha/omniauth-vkontakte&utm_campaign=Badge_Grade_Dashboard)
|
4
5
|
[![Gem Version][rubygems_badge]][rubygems]
|
5
|
-
[![
|
6
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/1ea61cb860f9f6aafb4f/maintainability)](https://codeclimate.com/github/mamantoha/omniauth-vkontakte/maintainability)
|
6
7
|
|
7
8
|
This is the unofficial [OmniAuth](https://github.com/intridea/omniauth) strategy for authenticating to VKontakte via OAuth.
|
8
9
|
To use it, you'll need to sign up for an OAuth2 Application ID and Secret
|
@@ -26,13 +27,12 @@ Here's a quick example, adding the middleware to a Rails app in `config/initiali
|
|
26
27
|
|
27
28
|
```ruby
|
28
29
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
29
|
-
provider :vkontakte, ENV['
|
30
|
+
provider :vkontakte, ENV['VK_API_ID'], ENV['VK_API_SECRET']
|
30
31
|
end
|
31
32
|
```
|
32
33
|
|
33
34
|
[See the example Sinatra app](https://github.com/mamantoha/omniauth-vkontakte/blob/master/examples/main.rb).
|
34
35
|
|
35
|
-
|
36
36
|
## Configuring
|
37
37
|
|
38
38
|
You can configure several options, which you pass in to the `provider` method via a `Hash`:
|
@@ -50,14 +50,12 @@ Here's an example of a possible configuration:
|
|
50
50
|
|
51
51
|
```ruby
|
52
52
|
use OmniAuth::Builder do
|
53
|
-
provider :vkontakte, ENV['
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
:image_size => 'original'
|
60
|
-
}
|
53
|
+
provider :vkontakte, ENV['VKONTAKTE_KEY'], ENV['VKONTAKTE_SECRET'],
|
54
|
+
scope: 'friends,audio,photos',
|
55
|
+
display: 'popup',
|
56
|
+
lang: 'en',
|
57
|
+
https: 1,
|
58
|
+
image_size: 'original'
|
61
59
|
end
|
62
60
|
```
|
63
61
|
|
@@ -101,13 +99,12 @@ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
|
|
101
99
|
|
102
100
|
The precise information available may depend on the permissions which you request.
|
103
101
|
|
104
|
-
|
105
102
|
## Supported Rubies
|
106
103
|
|
107
104
|
Tested with the following Ruby versions:
|
108
105
|
|
109
|
-
- Ruby MRI (
|
110
|
-
- JRuby (
|
106
|
+
- Ruby MRI (2.5.0+)
|
107
|
+
- JRuby (9.2.0+)
|
111
108
|
|
112
109
|
## Contributing to omniauth-vkontakte
|
113
110
|
|
@@ -115,20 +112,9 @@ Tested with the following Ruby versions:
|
|
115
112
|
|
116
113
|
## License
|
117
114
|
|
118
|
-
Copyright
|
119
|
-
|
120
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
121
|
-
|
122
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
115
|
+
Copyright: 2011-2021 Anton Maminov (anton.maminov@gmail.com)
|
123
116
|
|
124
|
-
|
125
|
-
|
126
|
-
[travis_badge]: http://img.shields.io/travis/mamantoha/omniauth-vkontakte.svg?style=flat
|
127
|
-
[travis]: https://travis-ci.org/mamantoha/omniauth-vkontakte
|
117
|
+
This library is distributed under the MIT license. Please see the LICENSE file.
|
128
118
|
|
129
119
|
[rubygems_badge]: http://img.shields.io/gem/v/omniauth-vkontakte.svg?style=flat
|
130
120
|
[rubygems]: http://rubygems.org/gems/omniauth-vkontakte
|
131
|
-
|
132
|
-
[codeclimate_badge]: http://img.shields.io/codeclimate/github/mamantoha/omniauth-vkontakte.svg?style=flat
|
133
|
-
[codeclimate]: https://codeclimate.com/github/mamantoha/omniauth-vkontakte
|
134
|
-
|
data/examples/Gemfile
CHANGED
data/examples/config.ru
CHANGED
data/examples/main.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'pp'
|
2
4
|
require 'sinatra'
|
3
5
|
require 'omniauth'
|
@@ -11,12 +13,10 @@ use Rack::Session::Cookie
|
|
11
13
|
|
12
14
|
use OmniAuth::Builder do
|
13
15
|
provider :vkontakte, ENV['VKONTAKTE_KEY'], ENV['VKONTAKTE_SECRET'],
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
image_size: 'original'
|
19
|
-
}
|
16
|
+
scope: SCOPE,
|
17
|
+
display: 'popup',
|
18
|
+
lang: 'en',
|
19
|
+
image_size: 'original'
|
20
20
|
end
|
21
21
|
|
22
22
|
get '/' do
|
data/lib/omniauth-vkontakte.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
-
|
2
|
-
require "omniauth"
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
3
|
+
require 'omniauth/vkontakte/version'
|
4
|
+
require 'omniauth'
|
5
|
+
|
6
|
+
# :nodoc:
|
4
7
|
module OmniAuth
|
8
|
+
# :nodoc:
|
5
9
|
module Strategies
|
6
|
-
autoload :Vkontakte,
|
10
|
+
autoload :Vkontakte, 'omniauth/strategies/vkontakte'
|
7
11
|
end
|
8
12
|
end
|
9
13
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'omniauth/strategies/oauth2'
|
2
4
|
|
3
5
|
module OmniAuth
|
@@ -13,19 +15,18 @@ module OmniAuth
|
|
13
15
|
class Vkontakte < OmniAuth::Strategies::OAuth2
|
14
16
|
class NoRawData < StandardError; end
|
15
17
|
|
16
|
-
API_VERSION = '5.
|
18
|
+
API_VERSION = '5.107'
|
17
19
|
|
18
20
|
DEFAULT_SCOPE = ''
|
19
21
|
|
20
22
|
option :name, 'vkontakte'
|
21
23
|
|
22
|
-
option :client_options,
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
}
|
24
|
+
option :client_options,
|
25
|
+
site: 'https://api.vk.com/',
|
26
|
+
token_url: 'https://oauth.vk.com/access_token',
|
27
|
+
authorize_url: 'https://oauth.vk.com/authorize'
|
27
28
|
|
28
|
-
option :authorize_options, [
|
29
|
+
option :authorize_options, %i[scope display]
|
29
30
|
|
30
31
|
option :redirect_url, nil
|
31
32
|
|
@@ -34,16 +35,16 @@ module OmniAuth
|
|
34
35
|
# https://github.com/intridea/omniauth/wiki/Auth-Hash-Schema
|
35
36
|
info do
|
36
37
|
{
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
38
|
+
name: "#{raw_info['first_name']} #{raw_info['last_name']}".strip,
|
39
|
+
nickname: raw_info['nickname'],
|
40
|
+
email: access_token.params['email'],
|
41
|
+
first_name: raw_info['first_name'],
|
42
|
+
last_name: raw_info['last_name'],
|
43
|
+
image: image_url,
|
44
|
+
location: location,
|
45
|
+
urls: {
|
45
46
|
'Vkontakte' => "http://vk.com/#{raw_info['screen_name']}"
|
46
|
-
}
|
47
|
+
}
|
47
48
|
}
|
48
49
|
end
|
49
50
|
|
@@ -57,21 +58,14 @@ module OmniAuth
|
|
57
58
|
access_token.options[:mode] = :query
|
58
59
|
access_token.options[:param_name] = :access_token
|
59
60
|
@raw_info ||= begin
|
60
|
-
|
61
|
-
:fields => info_options,
|
62
|
-
:lang => lang_option,
|
63
|
-
:https => https_option,
|
64
|
-
:v => API_VERSION,
|
65
|
-
}
|
61
|
+
result = access_token.get('/method/users.get', params: params).parsed['response']
|
66
62
|
|
67
|
-
result
|
63
|
+
raise NoRawData, result unless result.is_a?(Array) && result.first
|
68
64
|
|
69
|
-
raise NoRawData, result unless (result.is_a?(Array) and result.first)
|
70
65
|
result.first
|
71
66
|
end
|
72
67
|
end
|
73
68
|
|
74
|
-
|
75
69
|
# You can pass +display+, +revoke+ or +scope+ params to the auth request,
|
76
70
|
# if you need to set them dynamically.
|
77
71
|
#
|
@@ -82,12 +76,12 @@ module OmniAuth
|
|
82
76
|
super.tap do |params|
|
83
77
|
# just a copypaste from ominauth-facebook
|
84
78
|
%w[display state scope revoke].each do |v|
|
85
|
-
|
86
|
-
|
79
|
+
next unless request.params[v]
|
80
|
+
|
81
|
+
params[v.to_sym] = request.params[v]
|
87
82
|
|
88
|
-
|
89
|
-
|
90
|
-
end
|
83
|
+
# to support omniauth-oauth2's auto csrf protection
|
84
|
+
session['omniauth.state'] = params[:state] if v == 'state'
|
91
85
|
end
|
92
86
|
|
93
87
|
params[:scope] ||= DEFAULT_SCOPE
|
@@ -96,15 +90,27 @@ module OmniAuth
|
|
96
90
|
|
97
91
|
private
|
98
92
|
|
93
|
+
def params
|
94
|
+
{
|
95
|
+
fields: info_options,
|
96
|
+
lang: lang_option,
|
97
|
+
https: https_option,
|
98
|
+
v: API_VERSION
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
99
102
|
def callback_url
|
100
103
|
options.redirect_url || (full_host + script_name + callback_path)
|
101
104
|
end
|
102
105
|
|
103
106
|
def info_options
|
104
107
|
# http://vk.com/dev/fields
|
105
|
-
fields = %w[
|
108
|
+
fields = %w[
|
109
|
+
nickname screen_name sex city country online bdate
|
110
|
+
photo_50 photo_100 photo_200 photo_200_orig photo_400_orig
|
111
|
+
]
|
106
112
|
fields.concat(options[:info_fields].split(',')) if options[:info_fields]
|
107
|
-
|
113
|
+
fields.join(',')
|
108
114
|
end
|
109
115
|
|
110
116
|
def lang_option
|
data/omniauth-vkontakte.gemspec
CHANGED
@@ -1,18 +1,20 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path('lib/omniauth/vkontakte/version', __dir__)
|
2
4
|
|
3
5
|
Gem::Specification.new do |gem|
|
4
|
-
gem.authors = [
|
5
|
-
gem.email = [
|
6
|
-
gem.
|
7
|
-
gem.
|
8
|
-
gem.
|
6
|
+
gem.authors = ['Anton Maminov']
|
7
|
+
gem.email = ['anton.maminov@gmail.com']
|
8
|
+
gem.summary = 'Vkontakte OAuth2 Strategy for OmniAuth'
|
9
|
+
gem.homepage = 'https://github.com/mamantoha/omniauth-vkontakte'
|
10
|
+
gem.licenses = ['MIT']
|
9
11
|
|
10
|
-
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
11
13
|
gem.files = `git ls-files`.split("\n")
|
12
14
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
13
|
-
gem.name =
|
14
|
-
gem.require_paths = [
|
15
|
+
gem.name = 'omniauth-vkontakte'
|
16
|
+
gem.require_paths = ['lib']
|
15
17
|
gem.version = OmniAuth::Vkontakte::VERSION
|
16
|
-
|
17
|
-
gem.add_runtime_dependency 'omniauth-oauth2', '
|
18
|
+
gem.required_ruby_version = '>= 2.5.0'
|
19
|
+
gem.add_runtime_dependency 'omniauth-oauth2', ['>= 1.5', '<= 1.7.1']
|
18
20
|
end
|
@@ -1,14 +1,18 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe OmniAuth::Strategies::Vkontakte do
|
6
|
-
let(:request) { double('Request', :
|
6
|
+
let(:request) { double('Request', params: {}, cookies: {}, env: {}) }
|
7
7
|
|
8
8
|
before do
|
9
9
|
OmniAuth.config.test_mode = true
|
10
10
|
end
|
11
11
|
|
12
|
+
it 'should have version' do
|
13
|
+
expect(OmniAuth::Vkontakte::VERSION).to_not be_nil
|
14
|
+
end
|
15
|
+
|
12
16
|
subject do
|
13
17
|
args = ['api_key', 'api_secret', @options || {}].compact
|
14
18
|
obj = OmniAuth::Strategies::Vkontakte.new(*args).tap do |strategy|
|
@@ -19,7 +23,7 @@ describe OmniAuth::Strategies::Vkontakte do
|
|
19
23
|
@access_token = double('OAuth2::AccessToken')
|
20
24
|
allow(obj).to receive(:access_token).and_return(@access_token)
|
21
25
|
allow(@access_token).to receive(:get).and_return(double('OAuth2::Response'))
|
22
|
-
allow(@access_token).to receive(:params).and_return(
|
26
|
+
allow(@access_token).to receive(:params).and_return('email' => raw_info_hash['email'])
|
23
27
|
obj
|
24
28
|
end
|
25
29
|
|
@@ -78,40 +82,40 @@ describe OmniAuth::Strategies::Vkontakte do
|
|
78
82
|
describe 'image_size option' do
|
79
83
|
context 'when user has an image' do
|
80
84
|
it 'should return image with size specified' do
|
81
|
-
@options = { :
|
85
|
+
@options = { image_size: 'original' }
|
82
86
|
allow(subject).to receive(:raw_info).and_return(
|
83
|
-
|
87
|
+
raw_info_hash.merge('photo_200_orig' => img_url)
|
84
88
|
)
|
85
89
|
expect(subject.info[:image]).to eq(img_url)
|
86
90
|
end
|
87
91
|
|
88
92
|
it 'should return image with size specified' do
|
89
|
-
@options = { :
|
93
|
+
@options = { image_size: 'original_x2' }
|
90
94
|
allow(subject).to receive(:raw_info).and_return(
|
91
|
-
|
95
|
+
raw_info_hash.merge('photo_400_orig' => img_url)
|
92
96
|
)
|
93
97
|
expect(subject.info[:image]).to eq(img_url)
|
94
98
|
end
|
95
99
|
|
96
100
|
it 'should return bigger image when bigger size specified' do
|
97
|
-
@options = { :
|
101
|
+
@options = { image_size: 'bigger' }
|
98
102
|
allow(subject).to receive(:raw_info).and_return(
|
99
|
-
|
103
|
+
raw_info_hash.merge('photo_100' => img_url)
|
100
104
|
)
|
101
105
|
expect(subject.info[:image]).to eq(img_url)
|
102
106
|
end
|
103
107
|
|
104
108
|
it 'should return mini image when mini size specified' do
|
105
|
-
@options = { :
|
109
|
+
@options = { image_size: 'mini' }
|
106
110
|
allow(subject).to receive(:raw_info).and_return(
|
107
|
-
|
111
|
+
raw_info_hash.merge('photo_50' => img_url)
|
108
112
|
)
|
109
113
|
expect(subject.info[:image]).to eq(img_url)
|
110
114
|
end
|
111
115
|
|
112
116
|
it 'should return normal image by default' do
|
113
117
|
allow(subject).to receive(:raw_info).and_return(
|
114
|
-
|
118
|
+
raw_info_hash.merge('photo_50' => img_url)
|
115
119
|
)
|
116
120
|
expect(subject.info[:image]).to eq(img_url)
|
117
121
|
end
|
@@ -121,8 +125,8 @@ describe OmniAuth::Strategies::Vkontakte do
|
|
121
125
|
describe 'skip_info option' do
|
122
126
|
context 'when skip info option is enabled' do
|
123
127
|
it 'should not include raw_info in extras hash' do
|
124
|
-
@options = { :
|
125
|
-
allow(subject).to receive(:raw_info).and_return(
|
128
|
+
@options = { skip_info: true }
|
129
|
+
allow(subject).to receive(:raw_info).and_return(foo: 'bar')
|
126
130
|
expect(subject.extra[:raw_info]).to eq(nil)
|
127
131
|
end
|
128
132
|
end
|
@@ -131,12 +135,12 @@ describe OmniAuth::Strategies::Vkontakte do
|
|
131
135
|
describe 'request_phase' do
|
132
136
|
context 'with no request params set and redirect_url specified' do
|
133
137
|
before do
|
134
|
-
@options = { :
|
138
|
+
@options = { redirect_url: 'http://www.example.com/auth/vkontakte/callback' }
|
135
139
|
allow(subject).to receive(:env).and_return({})
|
136
140
|
allow(subject).to receive(:request).and_return(
|
137
|
-
double('Request',
|
138
|
-
|
139
|
-
|
141
|
+
double('Request', params: {}, scheme: 'https',
|
142
|
+
url: 'https://oauth.vk.com/authorize',
|
143
|
+
cookies: {}, env: {})
|
140
144
|
)
|
141
145
|
allow(subject).to receive(:request_phase).and_return(:whatever)
|
142
146
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path(__dir__)
|
4
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
3
5
|
require 'simplecov'
|
4
6
|
SimpleCov.start
|
5
7
|
require 'rspec'
|
6
|
-
require 'rack/test'
|
7
8
|
require 'webmock/rspec'
|
8
9
|
require 'omniauth'
|
9
10
|
require 'omniauth-vkontakte'
|
10
11
|
|
11
12
|
RSpec.configure do |config|
|
12
13
|
config.include WebMock::API
|
13
|
-
config.
|
14
|
-
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
14
|
+
config.extend OmniAuth::Test::StrategyMacros, type: :strategy
|
15
15
|
config.expect_with :rspec do |c|
|
16
16
|
c.syntax = :expect
|
17
17
|
end
|
metadata
CHANGED
@@ -1,55 +1,63 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-vkontakte
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Maminov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.5'
|
20
|
+
- - "<="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.7.1
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.5'
|
30
|
+
- - "<="
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
description:
|
32
|
+
version: 1.7.1
|
33
|
+
description:
|
28
34
|
email:
|
29
|
-
- anton.
|
35
|
+
- anton.maminov@gmail.com
|
30
36
|
executables: []
|
31
37
|
extensions: []
|
32
38
|
extra_rdoc_files: []
|
33
39
|
files:
|
40
|
+
- ".github/workflows/ruby.yml"
|
34
41
|
- ".gitignore"
|
35
42
|
- ".rspec"
|
36
|
-
- ".
|
43
|
+
- ".rubocop.yml"
|
37
44
|
- Gemfile
|
45
|
+
- LICENSE
|
38
46
|
- README.md
|
39
|
-
- Rakefile
|
40
47
|
- examples/.env.example
|
41
48
|
- examples/Gemfile
|
42
49
|
- examples/README.md
|
43
50
|
- examples/config.ru
|
44
51
|
- examples/main.rb
|
45
52
|
- lib/omniauth-vkontakte.rb
|
46
|
-
- lib/omniauth-vkontakte/version.rb
|
47
53
|
- lib/omniauth/strategies/vkontakte.rb
|
54
|
+
- lib/omniauth/vkontakte/version.rb
|
48
55
|
- omniauth-vkontakte.gemspec
|
49
56
|
- spec/omniauth/strategies/vkontakte_spec.rb
|
50
57
|
- spec/spec_helper.rb
|
51
58
|
homepage: https://github.com/mamantoha/omniauth-vkontakte
|
52
|
-
licenses:
|
59
|
+
licenses:
|
60
|
+
- MIT
|
53
61
|
metadata: {}
|
54
62
|
post_install_message:
|
55
63
|
rdoc_options: []
|
@@ -59,18 +67,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
59
67
|
requirements:
|
60
68
|
- - ">="
|
61
69
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
70
|
+
version: 2.5.0
|
63
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
72
|
requirements:
|
65
73
|
- - ">="
|
66
74
|
- !ruby/object:Gem::Version
|
67
75
|
version: '0'
|
68
76
|
requirements: []
|
69
|
-
|
70
|
-
rubygems_version: 2.6.13
|
77
|
+
rubygems_version: 3.2.3
|
71
78
|
signing_key:
|
72
79
|
specification_version: 4
|
73
|
-
summary:
|
74
|
-
test_files:
|
75
|
-
- spec/omniauth/strategies/vkontakte_spec.rb
|
76
|
-
- spec/spec_helper.rb
|
80
|
+
summary: Vkontakte OAuth2 Strategy for OmniAuth
|
81
|
+
test_files: []
|
data/.travis.yml
DELETED
data/Rakefile
DELETED