omniauth-openid 1.0.1 → 2.0.2

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.
data/Gemfile.lock DELETED
@@ -1,82 +0,0 @@
1
- GIT
2
- remote: git://github.com/mbleigh/ruby-openid.git
3
- revision: 4b6fdd152edbc9d1f617056879eb03bd82b78eb4
4
- specs:
5
- ruby-openid (2.1.8)
6
-
7
- PATH
8
- remote: .
9
- specs:
10
- omniauth-openid (1.0.0.beta1)
11
- omniauth (~> 1.0.0.beta1)
12
- rack-openid (~> 1.3.1)
13
-
14
- GEM
15
- remote: http://rubygems.org/
16
- specs:
17
- addressable (2.2.6)
18
- crack (0.3.1)
19
- diff-lcs (1.1.3)
20
- growl (1.0.3)
21
- guard (0.8.7)
22
- thor (~> 0.14.6)
23
- guard-rspec (0.5.0)
24
- guard (>= 0.8.4)
25
- hashie (1.2.0)
26
- multi_json (1.0.3)
27
- omniauth (1.0.0.pr2)
28
- hashie
29
- rack
30
- rack (1.3.5)
31
- rack-openid (1.3.1)
32
- rack (>= 1.1.0)
33
- ruby-openid (>= 2.1.8)
34
- rack-protection (1.1.2)
35
- rack
36
- rack-test (0.6.1)
37
- rack (>= 1.0)
38
- rake (0.9.2)
39
- rb-fsevent (0.4.3.1)
40
- rdiscount (1.6.8)
41
- rspec (2.7.0)
42
- rspec-core (~> 2.7.0)
43
- rspec-expectations (~> 2.7.0)
44
- rspec-mocks (~> 2.7.0)
45
- rspec-core (2.7.0)
46
- rspec-expectations (2.7.0)
47
- diff-lcs (~> 1.1.2)
48
- rspec-mocks (2.7.0)
49
- simplecov (0.5.4)
50
- multi_json (~> 1.0.3)
51
- simplecov-html (~> 0.5.3)
52
- simplecov-html (0.5.3)
53
- sinatra (1.3.0)
54
- rack (~> 1.3)
55
- rack-protection (~> 1.1)
56
- tilt (~> 1.3)
57
- thor (0.14.6)
58
- tilt (1.3.3)
59
- webmock (1.7.7)
60
- addressable (> 2.2.5, ~> 2.2)
61
- crack (>= 0.1.7)
62
- yard (0.7.2)
63
-
64
- PLATFORMS
65
- ruby
66
-
67
- DEPENDENCIES
68
- growl
69
- guard
70
- guard-rspec
71
- jruby-openssl (~> 0.7)
72
- omniauth-openid!
73
- rack-test (~> 0.5)
74
- rake (~> 0.8)
75
- rb-fsevent
76
- rdiscount (~> 1.6)
77
- rspec (~> 2.5)
78
- ruby-openid (= 2.1.8)!
79
- simplecov (~> 0.4)
80
- sinatra
81
- webmock (~> 1.7)
82
- yard (~> 0.7)
data/Guardfile DELETED
@@ -1,9 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard 'rspec', :version => 2 do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { "spec" }
8
- end
9
-
data/LICENSE DELETED
@@ -1,19 +0,0 @@
1
- Copyright (c) 2010-2011 Michael Bleigh and Intridea, Inc.
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
3
- require 'rspec/core/rake_task'
4
- RSpec::Core::RakeTask.new(:spec)
5
- task :default => :spec
6
- task :test => :spec
data/examples/sinatra.rb DELETED
@@ -1,28 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
-
4
- Bundler.setup :default, :development, :example
5
- require 'sinatra'
6
- require 'omniauth-openid'
7
- require 'openid/store/filesystem'
8
-
9
- use Rack::Session::Cookie
10
-
11
- use OmniAuth::Builder do
12
- provider :open_id, store: OpenID::Store::Filesystem.new('/tmp')
13
- end
14
-
15
- get '/' do
16
- <<-HTML
17
- <ul>
18
- <li><a href='/auth/open_id'>Sign in with OpenID</a></li>
19
- </ul>
20
- HTML
21
- end
22
-
23
- [:get, :post].each do |method|
24
- send method, '/auth/:provider/callback' do
25
- content_type 'text/plain'
26
- request.env['omniauth.auth'].info.to_hash.inspect
27
- end
28
- end
@@ -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
@@ -1,27 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path('../lib/omniauth-openid/version', __FILE__)
3
-
4
- Gem::Specification.new do |gem|
5
-
6
- gem.add_dependency 'omniauth', '~> 1.0'
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']
17
- gem.description = %q{OpenID strategy for OmniAuth.}
18
- gem.email = ['michael@intridea.com', 'sferik@gmail.com']
19
- gem.files = `git ls-files`.split("\n")
20
- gem.homepage = 'https://github.com/intridea/omniauth-openid'
21
- gem.name = 'omniauth-openid'
22
- gem.require_paths = ['lib']
23
- gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version=
24
- gem.summary = gem.description
25
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
26
- gem.version = OmniAuth::OpenID::VERSION
27
- end
@@ -1,91 +0,0 @@
1
- require 'spec_helper'
2
- require 'rack/openid'
3
- require 'omniauth-openid'
4
-
5
- describe OmniAuth::Strategies::OpenID, :type => :strategy do
6
- def app
7
- strat = OmniAuth::Strategies::OpenID
8
- Rack::Builder.new {
9
- use Rack::Session::Cookie
10
- use strat
11
- run lambda {|env| [404, {'Content-Type' => 'text/plain'}, [nil || env.key?('omniauth.auth').to_s]] }
12
- }.to_app
13
- end
14
-
15
- def expired_query_string
16
- 'openid=consumer&janrain_nonce=2011-07-21T20%3A14%3A56ZJ8LP3T&openid.assoc_handle=%7BHMAC-SHA1%7D%7B4e284c39%7D%7B9nvQeg%3D%3D%7D&openid.claimed_id=http%3A%2F%2Flocalhost%3A1123%2Fjohn.doe%3Fopenid.success%3Dtrue&openid.identity=http%3A%2F%2Flocalhost%3A1123%2Fjohn.doe%3Fopenid.success%3Dtrue&openid.mode=id_res&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.op_endpoint=http%3A%2F%2Flocalhost%3A1123%2Fserver%2F%3Fopenid.success%3Dtrue&openid.response_nonce=2011-07-21T20%3A14%3A56Zf9gC8S&openid.return_to=http%3A%2F%2Flocalhost%3A8888%2FDevelopment%2FWordpress%2Fwp_openid%2F%3Fopenid%3Dconsumer%26janrain_nonce%3D2011-07-21T20%253A14%253A56ZJ8LP3T&openid.sig=GufV13SUJt8VgmSZ92jGZCFBEvQ%3D&openid.signed=assoc_handle%2Cclaimed_id%2Cidentity%2Cmode%2Cns%2Cop_endpoint%2Cresponse_nonce%2Creturn_to%2Csigned'
17
- end
18
-
19
- describe '/auth/open_id without an identifier URL' do
20
- before do
21
- get '/auth/open_id'
22
- end
23
-
24
- it 'should respond with OK' do
25
- last_response.should be_ok
26
- end
27
-
28
- it 'should respond with HTML' do
29
- last_response.content_type.should == 'text/html'
30
- end
31
-
32
- it 'should render an identifier URL input' do
33
- last_response.body.should =~ %r{<input[^>]*openid_url}
34
- end
35
- end
36
-
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
-
58
- describe 'followed by /auth/open_id/callback' do
59
- context 'successful' do
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
-
67
- it "should set provider to open_id"
68
- it "should create auth_hash based on sreg"
69
- it "should create auth_hash based on ax"
70
-
71
- #it 'should call through to the master app' do
72
- # last_response.body.should == 'true'
73
- #end
74
- end
75
-
76
- context 'unsuccessful' do
77
- describe 'returning with expired credentials' do
78
- before do
79
- # get '/auth/open_id/callback?' + expired_query_string
80
- end
81
-
82
- it 'it should redirect to invalid credentials' do
83
- pending
84
- last_response.should be_redirect
85
- last_response.headers['Location'].should =~ %r{invalid_credentials}
86
- end
87
- end
88
- end
89
- end
90
-
91
- end
data/spec/spec_helper.rb DELETED
@@ -1,13 +0,0 @@
1
- $:.unshift File.dirname(__FILE__) + '/../lib'
2
-
3
- require 'simplecov'
4
- SimpleCov.start
5
- require 'rspec'
6
- require 'rack/test'
7
- require 'webmock/rspec'
8
- require 'omniauth-openid'
9
-
10
- RSpec.configure do |config|
11
- config.include WebMock::API
12
- config.include Rack::Test::Methods
13
- end