omniauth-gplus 1.1.1 → 1.2.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 +7 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +2 -0
- data/README.md +27 -4
- data/lib/omniauth/gplus/version.rb +1 -1
- data/lib/omniauth/strategies/gplus.rb +23 -3
- data/test/lib/omniauth/strategies/gplus_test.rb +22 -1
- metadata +44 -67
- data/.rvmrc +0 -48
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3b27c6b999a563a295475a758b28a5abb25615be
|
4
|
+
data.tar.gz: 3d50853471f6f69980a9e428da69b51171bf4ce2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 586765f643616bc55d40312d4d12cb4091e4075239651194ceae415d7b46d4a4885aad878c1e7f12226393e92c0bf19057ef6d0b96cd7ca4fc9be284af18341d
|
7
|
+
data.tar.gz: c117b95faca25542bfc7333cc956a21265d7f3c0157aea4353d4f3c63960f35e1dba149c8f33efbfdbb1e60354d899629b0b51ce42c8592273d39962fcd8420b
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
omniauth-gplus
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -22,12 +22,34 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
22
22
|
end
|
23
23
|
```
|
24
24
|
|
25
|
-
By default the gem uses the `email` scope, but you can get more information
|
25
|
+
By default the gem uses the `userinfo.email` scope, but you can get more information by using this interface:
|
26
26
|
|
27
27
|
``` ruby
|
28
|
-
provider :gplus, ENV['GPLUS_KEY'], ENV['GPLUS_SECRET'], scope: 'email, profile'
|
28
|
+
provider :gplus, ENV['GPLUS_KEY'], ENV['GPLUS_SECRET'], scope: 'userinfo.email, userinfo.profile'
|
29
29
|
```
|
30
30
|
|
31
|
+
Here are the different scopes:
|
32
|
+
|
33
|
+
- https://www.googleapis.com/auth/userinfo.email
|
34
|
+
- https://www.googleapis.com/auth/userinfo.profile
|
35
|
+
|
36
|
+
To identify the user as "me" in all requests use this scope:
|
37
|
+
|
38
|
+
- https://www.googleapis.com/auth/plus.me
|
39
|
+
|
40
|
+
To get all of these AND log the user in:
|
41
|
+
|
42
|
+
- https://www.googleapis.com/auth/plus.login
|
43
|
+
|
44
|
+
If you use the `plus.login` scope you can request `visibleactions` in order to allow your app to post App Activities on behalf of your users. To request `visibleactions`, use the following interface:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
provider :gplus, ENV['GPLUS_KEY'], ENV['GPLUS_SECRET'], scope: 'plus.login', request_visible_actions: 'AddActivity,BuyActivity'
|
48
|
+
```
|
49
|
+
|
50
|
+
To see and learn about all of the available App Activity types, visit: https://developers.google.com/+/api/moment-types/
|
51
|
+
|
52
|
+
|
31
53
|
The information schema looks like this:
|
32
54
|
|
33
55
|
``` ruby
|
@@ -113,7 +135,8 @@ Contributing
|
|
113
135
|
* **DO NOT CHANGE** ANY OF THESE (without making a new branch for *that* change):
|
114
136
|
* `*.gemspec`
|
115
137
|
* `Rakefile`
|
116
|
-
* `.
|
138
|
+
* `.ruby-version`
|
139
|
+
* `.ruby-gemset`
|
117
140
|
* `.gitignore`
|
118
141
|
* Any part of the git history
|
119
142
|
* **Write tests** specifically for the changes you've made, if no test exist
|
@@ -125,7 +148,7 @@ Credits
|
|
125
148
|
-------
|
126
149
|
|
127
150
|
- [Sam Dunne](https://github.com/samdunne), for initial work and bug fixes
|
128
|
-
|
151
|
+
|
129
152
|
|
130
153
|
License
|
131
154
|
-------
|
@@ -7,10 +7,14 @@ module OmniAuth
|
|
7
7
|
token_url: 'https://www.google.com/accounts/o8/oauth2/token'
|
8
8
|
}
|
9
9
|
|
10
|
+
option :authorize_options, [:scope, :request_visible_actions]
|
11
|
+
|
10
12
|
option :scope, 'userinfo.email'
|
11
13
|
|
14
|
+
option :request_visible_actions, nil
|
15
|
+
|
12
16
|
option :uid_field, :uid
|
13
|
-
|
17
|
+
|
14
18
|
uid do
|
15
19
|
raw_info['id']
|
16
20
|
end
|
@@ -40,12 +44,23 @@ module OmniAuth
|
|
40
44
|
def authorize_params
|
41
45
|
super.tap do |params|
|
42
46
|
params['scope'] = format_scopes(params['scope'])
|
47
|
+
if (params['request_visible_actions'])
|
48
|
+
params['request_visible_actions'] = format_actions(params['request_visible_actions'])
|
49
|
+
end
|
43
50
|
custom_parameters(params)
|
44
51
|
end
|
45
52
|
end
|
46
53
|
|
47
54
|
private
|
48
55
|
|
56
|
+
def format_actions(actions)
|
57
|
+
actions.split(/,\s*/).map(&method(:format_action)).join(" ")
|
58
|
+
end
|
59
|
+
|
60
|
+
def format_action(action)
|
61
|
+
"http://schemas.google.com/#{action}"
|
62
|
+
end
|
63
|
+
|
49
64
|
def format_scopes(scopes)
|
50
65
|
scopes.split(/,\s*/).map(&method(:format_scope)).join(" ")
|
51
66
|
end
|
@@ -55,11 +70,16 @@ module OmniAuth
|
|
55
70
|
end
|
56
71
|
|
57
72
|
def custom_parameters(params)
|
58
|
-
["scope", "client_options"].each { |k| add_key_to_params(params, k) }
|
73
|
+
["scope", "client_options", "state", "request_visible_actions"].each { |k| add_key_to_params(params, k) }
|
59
74
|
end
|
60
75
|
|
61
76
|
def add_key_to_params(params, key)
|
62
|
-
|
77
|
+
if request.params[key]
|
78
|
+
params[key] = request.params[key]
|
79
|
+
|
80
|
+
# to support omniauth-oauth2's auto csrf protection
|
81
|
+
session['omniauth.state'] = params[:state] if key == 'state'
|
82
|
+
end
|
63
83
|
end
|
64
84
|
|
65
85
|
def raw_info
|
@@ -36,6 +36,27 @@ class TestOmniAuthGPlus < MiniTest::Unit::TestCase
|
|
36
36
|
assert_equal(expected, actual)
|
37
37
|
end
|
38
38
|
|
39
|
+
def test_default_request_visible_actions_is_nil
|
40
|
+
expected = nil
|
41
|
+
actual = strategy.options['request_visible_actions']
|
42
|
+
assert_equal(expected, actual)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_state_state_is_included_in_request_params_when_present
|
46
|
+
expected = 'some_state'
|
47
|
+
@request.stubs(:params).returns({ 'state' => expected })
|
48
|
+
assert_equal expected, strategy.authorize_params[:state]
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_stores_state_in_the_session_when_present
|
52
|
+
expected = 'some_state'
|
53
|
+
@request.stubs(:params).returns({ 'state' => expected })
|
54
|
+
refute_empty strategy.authorize_params['state']
|
55
|
+
assert_equal expected, strategy.authorize_params[:state]
|
56
|
+
refute_empty strategy.session['omniauth.state']
|
57
|
+
assert_equal expected, strategy.session['omniauth.state']
|
58
|
+
end
|
59
|
+
|
39
60
|
def test_that_it_has_a_version_number
|
40
61
|
refute_nil OmniAuth::GPlus::VERSION
|
41
62
|
end
|
@@ -49,7 +70,7 @@ class TestOmniAuthGPlus < MiniTest::Unit::TestCase
|
|
49
70
|
actual = new_oauth.options.uid_field
|
50
71
|
assert_equal(expected, actual)
|
51
72
|
end
|
52
|
-
|
73
|
+
|
53
74
|
def test_uid_not_nil
|
54
75
|
refute_nil(new_oauth.options.uid_field)
|
55
76
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-gplus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Kurtis Rainbolt-Greene
|
@@ -10,136 +9,120 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2013-
|
12
|
+
date: 2013-07-16 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
|
-
version_requirements: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ~>
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '1.1'
|
21
|
-
none: false
|
22
|
-
prerelease: false
|
23
15
|
name: omniauth-oauth2
|
24
16
|
requirement: !ruby/object:Gem::Requirement
|
25
17
|
requirements:
|
26
18
|
- - ~>
|
27
19
|
- !ruby/object:Gem::Version
|
28
20
|
version: '1.1'
|
29
|
-
none: false
|
30
21
|
type: :runtime
|
31
|
-
|
22
|
+
prerelease: false
|
32
23
|
version_requirements: !ruby/object:Gem::Requirement
|
33
24
|
requirements:
|
34
|
-
- -
|
25
|
+
- - ~>
|
35
26
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
37
|
-
|
38
|
-
prerelease: false
|
27
|
+
version: '1.1'
|
28
|
+
- !ruby/object:Gem::Dependency
|
39
29
|
name: bundler
|
40
30
|
requirement: !ruby/object:Gem::Requirement
|
41
31
|
requirements:
|
42
|
-
- -
|
32
|
+
- - '>='
|
43
33
|
- !ruby/object:Gem::Version
|
44
34
|
version: '0'
|
45
|
-
none: false
|
46
35
|
type: :development
|
47
|
-
|
36
|
+
prerelease: false
|
48
37
|
version_requirements: !ruby/object:Gem::Requirement
|
49
38
|
requirements:
|
50
|
-
- -
|
39
|
+
- - '>='
|
51
40
|
- !ruby/object:Gem::Version
|
52
41
|
version: '0'
|
53
|
-
|
54
|
-
prerelease: false
|
42
|
+
- !ruby/object:Gem::Dependency
|
55
43
|
name: rake
|
56
44
|
requirement: !ruby/object:Gem::Requirement
|
57
45
|
requirements:
|
58
|
-
- -
|
46
|
+
- - '>='
|
59
47
|
- !ruby/object:Gem::Version
|
60
48
|
version: '0'
|
61
|
-
none: false
|
62
49
|
type: :development
|
63
|
-
|
50
|
+
prerelease: false
|
64
51
|
version_requirements: !ruby/object:Gem::Requirement
|
65
52
|
requirements:
|
66
|
-
- -
|
53
|
+
- - '>='
|
67
54
|
- !ruby/object:Gem::Version
|
68
55
|
version: '0'
|
69
|
-
|
70
|
-
prerelease: false
|
56
|
+
- !ruby/object:Gem::Dependency
|
71
57
|
name: mocha
|
72
58
|
requirement: !ruby/object:Gem::Requirement
|
73
59
|
requirements:
|
74
|
-
- -
|
60
|
+
- - '>='
|
75
61
|
- !ruby/object:Gem::Version
|
76
62
|
version: '0'
|
77
|
-
none: false
|
78
63
|
type: :development
|
79
|
-
|
64
|
+
prerelease: false
|
80
65
|
version_requirements: !ruby/object:Gem::Requirement
|
81
66
|
requirements:
|
82
|
-
- -
|
67
|
+
- - '>='
|
83
68
|
- !ruby/object:Gem::Version
|
84
69
|
version: '0'
|
85
|
-
|
86
|
-
prerelease: false
|
70
|
+
- !ruby/object:Gem::Dependency
|
87
71
|
name: yard
|
88
72
|
requirement: !ruby/object:Gem::Requirement
|
89
73
|
requirements:
|
90
|
-
- -
|
74
|
+
- - '>='
|
91
75
|
- !ruby/object:Gem::Version
|
92
76
|
version: '0'
|
93
|
-
none: false
|
94
77
|
type: :development
|
95
|
-
|
78
|
+
prerelease: false
|
96
79
|
version_requirements: !ruby/object:Gem::Requirement
|
97
80
|
requirements:
|
98
|
-
- -
|
81
|
+
- - '>='
|
99
82
|
- !ruby/object:Gem::Version
|
100
83
|
version: '0'
|
101
|
-
|
102
|
-
prerelease: false
|
84
|
+
- !ruby/object:Gem::Dependency
|
103
85
|
name: kramdown
|
104
86
|
requirement: !ruby/object:Gem::Requirement
|
105
87
|
requirements:
|
106
|
-
- -
|
88
|
+
- - '>='
|
107
89
|
- !ruby/object:Gem::Version
|
108
90
|
version: '0'
|
109
|
-
none: false
|
110
91
|
type: :development
|
111
|
-
|
92
|
+
prerelease: false
|
112
93
|
version_requirements: !ruby/object:Gem::Requirement
|
113
94
|
requirements:
|
114
|
-
- -
|
95
|
+
- - '>='
|
115
96
|
- !ruby/object:Gem::Version
|
116
97
|
version: '0'
|
117
|
-
|
118
|
-
prerelease: false
|
98
|
+
- !ruby/object:Gem::Dependency
|
119
99
|
name: pry
|
120
100
|
requirement: !ruby/object:Gem::Requirement
|
121
101
|
requirements:
|
122
|
-
- -
|
102
|
+
- - '>='
|
123
103
|
- !ruby/object:Gem::Version
|
124
104
|
version: '0'
|
125
|
-
none: false
|
126
105
|
type: :development
|
127
|
-
|
106
|
+
prerelease: false
|
128
107
|
version_requirements: !ruby/object:Gem::Requirement
|
129
108
|
requirements:
|
130
|
-
- -
|
109
|
+
- - '>='
|
131
110
|
- !ruby/object:Gem::Version
|
132
111
|
version: '0'
|
133
|
-
|
134
|
-
prerelease: false
|
112
|
+
- !ruby/object:Gem::Dependency
|
135
113
|
name: coveralls
|
136
114
|
requirement: !ruby/object:Gem::Requirement
|
137
115
|
requirements:
|
138
|
-
- -
|
116
|
+
- - '>='
|
139
117
|
- !ruby/object:Gem::Version
|
140
118
|
version: '0'
|
141
|
-
none: false
|
142
119
|
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
143
126
|
description: A Google+ OAuth2 solution for Omniauth
|
144
127
|
email:
|
145
128
|
- me@kurtisrainboltgreene.name
|
@@ -150,7 +133,8 @@ extra_rdoc_files: []
|
|
150
133
|
files:
|
151
134
|
- .coveralls.yml
|
152
135
|
- .gitignore
|
153
|
-
- .
|
136
|
+
- .ruby-gemset
|
137
|
+
- .ruby-version
|
154
138
|
- .travis.yml
|
155
139
|
- Gemfile
|
156
140
|
- LICENSE.txt
|
@@ -165,33 +149,26 @@ files:
|
|
165
149
|
homepage: http://krainboltgreene.github.com/omniauth-gplus
|
166
150
|
licenses:
|
167
151
|
- MIT
|
152
|
+
metadata: {}
|
168
153
|
post_install_message:
|
169
154
|
rdoc_options: []
|
170
155
|
require_paths:
|
171
156
|
- lib
|
172
157
|
required_ruby_version: !ruby/object:Gem::Requirement
|
173
158
|
requirements:
|
174
|
-
- -
|
159
|
+
- - '>='
|
175
160
|
- !ruby/object:Gem::Version
|
176
|
-
hash: 3554233067913369947
|
177
161
|
version: '0'
|
178
|
-
segments:
|
179
|
-
- 0
|
180
|
-
none: false
|
181
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
163
|
requirements:
|
183
|
-
- -
|
164
|
+
- - '>='
|
184
165
|
- !ruby/object:Gem::Version
|
185
|
-
hash: 3554233067913369947
|
186
166
|
version: '0'
|
187
|
-
segments:
|
188
|
-
- 0
|
189
|
-
none: false
|
190
167
|
requirements: []
|
191
168
|
rubyforge_project:
|
192
|
-
rubygems_version:
|
169
|
+
rubygems_version: 2.0.5
|
193
170
|
signing_key:
|
194
|
-
specification_version:
|
171
|
+
specification_version: 4
|
195
172
|
summary: A Google+ OAuth2 solution for Omniauth
|
196
173
|
test_files:
|
197
174
|
- test/helper.rb
|
data/.rvmrc
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
|
3
|
-
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
4
|
-
# development environment upon cd'ing into the directory
|
5
|
-
|
6
|
-
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
|
7
|
-
# Only full ruby name is supported here, for short names use:
|
8
|
-
# echo "rvm use 1.9.3" > .rvmrc
|
9
|
-
environment_id="ruby-1.9.3-p392@omniauth-gplus"
|
10
|
-
|
11
|
-
# Uncomment the following lines if you want to verify rvm version per project
|
12
|
-
# rvmrc_rvm_version="1.18.18 (stable)" # 1.10.1 seams as a safe start
|
13
|
-
# eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
|
14
|
-
# echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
|
15
|
-
# return 1
|
16
|
-
# }
|
17
|
-
|
18
|
-
# First we attempt to load the desired environment directly from the environment
|
19
|
-
# file. This is very fast and efficient compared to running through the entire
|
20
|
-
# CLI and selector. If you want feedback on which environment was used then
|
21
|
-
# insert the word 'use' after --create as this triggers verbose mode.
|
22
|
-
if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
|
23
|
-
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
|
24
|
-
then
|
25
|
-
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
26
|
-
[[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
|
27
|
-
\. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
|
28
|
-
else
|
29
|
-
# If the environment file has not yet been created, use the RVM CLI to select.
|
30
|
-
rvm --create "$environment_id" || {
|
31
|
-
echo "Failed to create RVM environment '${environment_id}'."
|
32
|
-
return 1
|
33
|
-
}
|
34
|
-
fi
|
35
|
-
|
36
|
-
# If you use bundler, this might be useful to you:
|
37
|
-
# if [[ -s Gemfile ]] && {
|
38
|
-
# ! builtin command -v bundle >/dev/null ||
|
39
|
-
# builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
|
40
|
-
# }
|
41
|
-
# then
|
42
|
-
# printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
|
43
|
-
# gem install bundler
|
44
|
-
# fi
|
45
|
-
# if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
|
46
|
-
# then
|
47
|
-
# bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
|
48
|
-
# fi
|