omniauth-openid 1.0.1 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +1 -1
- data/.travis.yml +23 -0
- data/Gemfile +8 -5
- data/lib/omniauth-openid/version.rb +1 -1
- data/omniauth-openid.gemspec +5 -12
- data/spec/omniauth/strategies/open_id_spec.rb +36 -37
- data/spec/spec_helper.rb +4 -0
- metadata +33 -98
- data/lib/omniauth/strategies/steam.rb +0 -55
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 13be670416c096d0ac1f7a7f5248d5b58e806b3b69883eafafc25ed83c230ee5
|
4
|
+
data.tar.gz: a3b59e5573339f46695c9e8ed92858f5d9e3f5990c646299f7989d95afbd8791
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e92d418d26125e3522d4c122e940502795b0cbf73940dfa4d2c8c6deae37b5c7fff95f3c88f4589cf1328041e9524ff4acdb355f15e2b008aec8c0e2ed30c248
|
7
|
+
data.tar.gz: 8a23a7180d5a08a8ede236d7ab92d5471b23e4940250e4094f83be6c72388ee46e5b3728831d115cac762637711589756e7477a7402a136ae004532205e63c74
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
--color
|
2
|
-
--format
|
2
|
+
--format progress
|
data/.travis.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
bundler_args: --without development
|
2
|
+
before_install:
|
3
|
+
- gem update --system
|
4
|
+
- gem update bundler
|
5
|
+
cache: bundler
|
6
|
+
env:
|
7
|
+
global:
|
8
|
+
- JRUBY_OPTS="$JRUBY_OPTS --debug"
|
9
|
+
language: ruby
|
10
|
+
rvm:
|
11
|
+
- jruby-9.2.14.0
|
12
|
+
- 2.4.10
|
13
|
+
- 2.5.8
|
14
|
+
- 2.6.6
|
15
|
+
- 2.7.2
|
16
|
+
- jruby-head
|
17
|
+
- ruby-head
|
18
|
+
matrix:
|
19
|
+
allow_failures:
|
20
|
+
- rvm: jruby-head
|
21
|
+
- rvm: ruby-head
|
22
|
+
fast_finish: true
|
23
|
+
sudo: false
|
data/Gemfile
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
|
+
gem 'rake', '~> 12.0'
|
4
|
+
|
3
5
|
platforms :jruby do
|
4
|
-
gem 'jruby-openssl', '~> 0.
|
6
|
+
gem 'jruby-openssl', '~> 0.9'
|
5
7
|
end
|
6
8
|
|
7
9
|
gem 'ruby-openid', '2.1.8', :git => 'git://github.com/mbleigh/ruby-openid.git'
|
@@ -9,10 +11,11 @@ gem 'ruby-openid', '2.1.8', :git => 'git://github.com/mbleigh/ruby-openid.git'
|
|
9
11
|
gemspec
|
10
12
|
|
11
13
|
group :development, :test do
|
12
|
-
gem '
|
13
|
-
gem '
|
14
|
-
gem '
|
15
|
-
gem '
|
14
|
+
gem 'rack-test'
|
15
|
+
gem 'rspec', '>= 3.0'
|
16
|
+
gem 'simplecov', '>= 0.9'
|
17
|
+
gem 'webmock', '~> 3.0'
|
18
|
+
gem 'yard', '>= 0.9.11'
|
16
19
|
end
|
17
20
|
|
18
21
|
group :example do
|
data/omniauth-openid.gemspec
CHANGED
@@ -2,24 +2,17 @@
|
|
2
2
|
require File.expand_path('../lib/omniauth-openid/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
+
gem.add_dependency 'omniauth', ['>= 1.0', '< 3.0']
|
6
|
+
gem.add_dependency 'rack-openid', '~> 1.4.0'
|
5
7
|
|
6
|
-
gem.
|
7
|
-
gem.add_dependency 'rack-openid', '~> 1.3.1'
|
8
|
-
gem.add_development_dependency 'rack-test', '~> 0.5'
|
9
|
-
gem.add_development_dependency 'rake', '~> 0.8'
|
10
|
-
gem.add_development_dependency 'rdiscount', '~> 1.6'
|
11
|
-
gem.add_development_dependency 'rspec', '~> 2.7'
|
12
|
-
gem.add_development_dependency 'simplecov', '~> 0.4'
|
13
|
-
gem.add_development_dependency 'webmock', '~> 1.7'
|
14
|
-
gem.add_development_dependency 'yard', '~> 0.7'
|
15
|
-
|
16
|
-
gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober']
|
8
|
+
gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober', 'Tom Milewski']
|
17
9
|
gem.description = %q{OpenID strategy for OmniAuth.}
|
18
|
-
gem.email = ['michael@intridea.com', 'sferik@gmail.com']
|
10
|
+
gem.email = ['michael@intridea.com', 'sferik@gmail.com', 'tmilewski@gmail.com']
|
19
11
|
gem.files = `git ls-files`.split("\n")
|
20
12
|
gem.homepage = 'https://github.com/intridea/omniauth-openid'
|
21
13
|
gem.name = 'omniauth-openid'
|
22
14
|
gem.require_paths = ['lib']
|
15
|
+
gem.license = 'MIT'
|
23
16
|
gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version=
|
24
17
|
gem.summary = gem.description
|
25
18
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -6,7 +6,7 @@ describe OmniAuth::Strategies::OpenID, :type => :strategy do
|
|
6
6
|
def app
|
7
7
|
strat = OmniAuth::Strategies::OpenID
|
8
8
|
Rack::Builder.new {
|
9
|
-
use Rack::Session::Cookie
|
9
|
+
use Rack::Session::Cookie, secret: 'foobar'
|
10
10
|
use strat
|
11
11
|
run lambda {|env| [404, {'Content-Type' => 'text/plain'}, [nil || env.key?('omniauth.auth').to_s]] }
|
12
12
|
}.to_app
|
@@ -18,59 +18,59 @@ describe OmniAuth::Strategies::OpenID, :type => :strategy do
|
|
18
18
|
|
19
19
|
describe '/auth/open_id without an identifier URL' do
|
20
20
|
before do
|
21
|
-
|
21
|
+
post '/auth/open_id'
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'should respond with OK' do
|
25
|
-
last_response.
|
25
|
+
expect(last_response).to be_ok
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'should respond with HTML' do
|
29
|
-
last_response.content_type.
|
29
|
+
expect(last_response.content_type).to eq 'text/html'
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should render an identifier URL input' do
|
33
|
-
last_response.body.
|
33
|
+
expect(last_response.body).to match %r{<input[^>]*openid_url}
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
#describe '/auth/open_id with an identifier URL' do
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#end
|
37
|
+
# describe '/auth/open_id with an identifier URL' do
|
38
|
+
# context 'successful' do
|
39
|
+
# before do
|
40
|
+
# @identifier_url = 'http://me.example.org'
|
41
|
+
# # TODO: change this mock to actually return some sort of OpenID response
|
42
|
+
# stub_request(:get, @identifier_url)
|
43
|
+
# get '/auth/open_id?openid_url=' + @identifier_url
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# it 'should redirect to the OpenID identity URL' do
|
47
|
+
# last_response.should be_redirect
|
48
|
+
# last_response.headers['Location'].should =~ %r{^#{@identifier_url}.*}
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# it 'should tell the OpenID server to return to the callback URL' do
|
52
|
+
# return_to = CGI.escape(last_request.url + '/callback')
|
53
|
+
# last_response.headers['Location'].should =~ %r{[\?&]openid.return_to=#{return_to}}
|
54
|
+
# end
|
55
|
+
# end
|
56
|
+
# end
|
57
57
|
|
58
58
|
describe 'followed by /auth/open_id/callback' do
|
59
59
|
context 'successful' do
|
60
|
-
#before do
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#end
|
60
|
+
# before do
|
61
|
+
# @identifier_url = 'http://me.example.org'
|
62
|
+
# # TODO: change this mock to actually return some sort of OpenID response
|
63
|
+
# stub_request(:get, @identifier_url)
|
64
|
+
# get '/auth/open_id/callback'
|
65
|
+
# end
|
66
66
|
|
67
67
|
it "should set provider to open_id"
|
68
68
|
it "should create auth_hash based on sreg"
|
69
69
|
it "should create auth_hash based on ax"
|
70
70
|
|
71
|
-
#it 'should call through to the master app' do
|
72
|
-
#
|
73
|
-
#end
|
71
|
+
# it 'should call through to the master app' do
|
72
|
+
# last_response.body.should == 'true'
|
73
|
+
# end
|
74
74
|
end
|
75
75
|
|
76
76
|
context 'unsuccessful' do
|
@@ -81,11 +81,10 @@ describe OmniAuth::Strategies::OpenID, :type => :strategy do
|
|
81
81
|
|
82
82
|
it 'it should redirect to invalid credentials' do
|
83
83
|
pending
|
84
|
-
last_response.
|
85
|
-
last_response.
|
84
|
+
expect(last_response).to be_redirect
|
85
|
+
expect(last_response).to match %r{invalid_credentials}
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
90
|
-
|
91
90
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,128 +1,65 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-openid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Michael Bleigh
|
9
8
|
- Erik Michaels-Ober
|
9
|
+
- Tom Milewski
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-01-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: omniauth
|
17
|
-
requirement:
|
18
|
-
none: false
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
19
18
|
requirements:
|
20
|
-
- -
|
19
|
+
- - ">="
|
21
20
|
- !ruby/object:Gem::Version
|
22
21
|
version: '1.0'
|
23
|
-
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: *70221645863580
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: rack-openid
|
28
|
-
requirement: &70221645858920 !ruby/object:Gem::Requirement
|
29
|
-
none: false
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
22
|
+
- - "<"
|
32
23
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
24
|
+
version: '3.0'
|
34
25
|
type: :runtime
|
35
26
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: rack-test
|
39
|
-
requirement: &70221645855080 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
|
-
requirements:
|
42
|
-
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version: '0.5'
|
45
|
-
type: :development
|
46
|
-
prerelease: false
|
47
|
-
version_requirements: *70221645855080
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: rake
|
50
|
-
requirement: &70221645849280 !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
|
-
requirements:
|
53
|
-
- - ~>
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0.8'
|
56
|
-
type: :development
|
57
|
-
prerelease: false
|
58
|
-
version_requirements: *70221645849280
|
59
|
-
- !ruby/object:Gem::Dependency
|
60
|
-
name: rdiscount
|
61
|
-
requirement: &70221645846800 !ruby/object:Gem::Requirement
|
62
|
-
none: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
28
|
requirements:
|
64
|
-
- -
|
29
|
+
- - ">="
|
65
30
|
- !ruby/object:Gem::Version
|
66
|
-
version: '1.
|
67
|
-
|
68
|
-
prerelease: false
|
69
|
-
version_requirements: *70221645846800
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: rspec
|
72
|
-
requirement: &70221645842660 !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '2.7'
|
78
|
-
type: :development
|
79
|
-
prerelease: false
|
80
|
-
version_requirements: *70221645842660
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: simplecov
|
83
|
-
requirement: &70221645838580 !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
|
-
requirements:
|
86
|
-
- - ~>
|
31
|
+
version: '1.0'
|
32
|
+
- - "<"
|
87
33
|
- !ruby/object:Gem::Version
|
88
|
-
version: '0
|
89
|
-
type: :development
|
90
|
-
prerelease: false
|
91
|
-
version_requirements: *70221645838580
|
34
|
+
version: '3.0'
|
92
35
|
- !ruby/object:Gem::Dependency
|
93
|
-
name:
|
94
|
-
requirement:
|
95
|
-
none: false
|
36
|
+
name: rack-openid
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
96
38
|
requirements:
|
97
|
-
- - ~>
|
39
|
+
- - "~>"
|
98
40
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
100
|
-
type: :
|
41
|
+
version: 1.4.0
|
42
|
+
type: :runtime
|
101
43
|
prerelease: false
|
102
|
-
version_requirements:
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: yard
|
105
|
-
requirement: &70221645830920 !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
45
|
requirements:
|
108
|
-
- - ~>
|
46
|
+
- - "~>"
|
109
47
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
111
|
-
type: :development
|
112
|
-
prerelease: false
|
113
|
-
version_requirements: *70221645830920
|
48
|
+
version: 1.4.0
|
114
49
|
description: OpenID strategy for OmniAuth.
|
115
50
|
email:
|
116
51
|
- michael@intridea.com
|
117
52
|
- sferik@gmail.com
|
53
|
+
- tmilewski@gmail.com
|
118
54
|
executables: []
|
119
55
|
extensions: []
|
120
56
|
extra_rdoc_files: []
|
121
57
|
files:
|
122
|
-
- .gemtest
|
123
|
-
- .gitignore
|
124
|
-
- .rspec
|
125
|
-
- .
|
58
|
+
- ".gemtest"
|
59
|
+
- ".gitignore"
|
60
|
+
- ".rspec"
|
61
|
+
- ".travis.yml"
|
62
|
+
- ".yardopts"
|
126
63
|
- Gemfile
|
127
64
|
- Gemfile.lock
|
128
65
|
- Guardfile
|
@@ -133,33 +70,31 @@ files:
|
|
133
70
|
- lib/omniauth-openid.rb
|
134
71
|
- lib/omniauth-openid/version.rb
|
135
72
|
- lib/omniauth/strategies/open_id.rb
|
136
|
-
- lib/omniauth/strategies/steam.rb
|
137
73
|
- omniauth-openid.gemspec
|
138
74
|
- spec/omniauth/strategies/open_id_spec.rb
|
139
75
|
- spec/spec_helper.rb
|
140
76
|
homepage: https://github.com/intridea/omniauth-openid
|
141
|
-
licenses:
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata: {}
|
142
80
|
post_install_message:
|
143
81
|
rdoc_options: []
|
144
82
|
require_paths:
|
145
83
|
- lib
|
146
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
-
none: false
|
148
85
|
requirements:
|
149
|
-
- -
|
86
|
+
- - ">="
|
150
87
|
- !ruby/object:Gem::Version
|
151
88
|
version: '0'
|
152
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
90
|
requirements:
|
155
|
-
- -
|
91
|
+
- - ">="
|
156
92
|
- !ruby/object:Gem::Version
|
157
93
|
version: 1.3.6
|
158
94
|
requirements: []
|
159
|
-
|
160
|
-
rubygems_version: 1.8.10
|
95
|
+
rubygems_version: 3.0.0
|
161
96
|
signing_key:
|
162
|
-
specification_version:
|
97
|
+
specification_version: 4
|
163
98
|
summary: OpenID strategy for OmniAuth.
|
164
99
|
test_files:
|
165
100
|
- spec/omniauth/strategies/open_id_spec.rb
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'omniauth/openid'
|
2
|
-
module OmniAuth
|
3
|
-
module Strategies
|
4
|
-
class Steam < OmniAuth::Strategies::OpenID
|
5
|
-
def initialize(app, store = nil, api_key = nil, options = {}, &block)
|
6
|
-
options[:identifier] ||= "http://steamcommunity.com/openid"
|
7
|
-
options[:name] ||= 'steam'
|
8
|
-
@api_key = api_key
|
9
|
-
super(app, store, options, &block)
|
10
|
-
end
|
11
|
-
|
12
|
-
def user_info(response=nil)
|
13
|
-
player = user_hash['response']['players']['player'].first
|
14
|
-
nickname = player["personaname"]
|
15
|
-
name = player["realname"]
|
16
|
-
url = player["profileurl"]
|
17
|
-
country = player["loccountrycode"]
|
18
|
-
state = player["locstatecode"]
|
19
|
-
city = player["loccityid"]
|
20
|
-
|
21
|
-
{
|
22
|
-
'nickname' => nickname,
|
23
|
-
'name' => name,
|
24
|
-
'url' => url,
|
25
|
-
'location' => "#{city}, #{state}, #{country}"
|
26
|
-
}
|
27
|
-
end
|
28
|
-
|
29
|
-
def user_hash
|
30
|
-
# Steam provides no information back on a openid response other than a 64bit user id
|
31
|
-
# Need to use this information and make a API call to get user information from steam.
|
32
|
-
if @api_key
|
33
|
-
unless @user_hash
|
34
|
-
uri = URI.parse("http://api.steampowered.com/")
|
35
|
-
req = Net::HTTP::Get.new("#{uri.path}ISteamUser/GetPlayerSummaries/v0001/?key=#{@api_key}&steamids=#{@openid_response.display_identifier.split("/").last}")
|
36
|
-
res = Net::HTTP.start(uri.host, uri.port) {|http|
|
37
|
-
http.request(req)
|
38
|
-
}
|
39
|
-
end
|
40
|
-
@user_hash ||= MultiJson.decode(res.body)
|
41
|
-
else
|
42
|
-
{}
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def auth_hash
|
47
|
-
OmniAuth::Utils.deep_merge(super, {
|
48
|
-
'uid' => @openid_response.display_identifier.split("/").last,
|
49
|
-
'user_info' => user_info,
|
50
|
-
'extra' => {'user_hash' => user_hash}
|
51
|
-
})
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|