pax_global_header 0000666 0000000 0000000 00000000064 12150423572 0014513 g ustar 00root root 0000000 0000000 52 comment=30e8d2533fe6df9f6fb8ee8f3171091dd00add0e ruby-omniauth-openid-1.0.1/ 0000775 0000000 0000000 00000000000 12150423572 0015571 5 ustar 00root root 0000000 0000000 ruby-omniauth-openid-1.0.1/.gemtest 0000664 0000000 0000000 00000000000 12150423572 0017230 0 ustar 00root root 0000000 0000000 ruby-omniauth-openid-1.0.1/.gitignore 0000664 0000000 0000000 00000000234 12150423572 0017560 0 ustar 00root root 0000000 0000000 *.gem *.rbc .bundle .config .yardoc Gemfile.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man /pkg rdoc spec/reports test/tmp test/version_tmp tmp ruby-omniauth-openid-1.0.1/.rspec 0000664 0000000 0000000 00000000030 12150423572 0016677 0 ustar 00root root 0000000 0000000 --color --format=nested ruby-omniauth-openid-1.0.1/.yardopts 0000664 0000000 0000000 00000000065 12150423572 0017440 0 ustar 00root root 0000000 0000000 --markup markdown --markup-provider maruku - LICENSE ruby-omniauth-openid-1.0.1/Gemfile 0000664 0000000 0000000 00000000473 12150423572 0017070 0 ustar 00root root 0000000 0000000 source 'http://rubygems.org' platforms :jruby do gem 'jruby-openssl', '~> 0.7' end gem 'ruby-openid', '2.1.8', :git => 'git://github.com/mbleigh/ruby-openid.git' gemspec group :development, :test do gem 'guard' gem 'guard-rspec' gem 'growl' gem 'rb-fsevent' end group :example do gem 'sinatra' end ruby-omniauth-openid-1.0.1/Gemfile.lock 0000664 0000000 0000000 00000003144 12150423572 0020015 0 ustar 00root root 0000000 0000000 GIT remote: git://github.com/mbleigh/ruby-openid.git revision: 4b6fdd152edbc9d1f617056879eb03bd82b78eb4 specs: ruby-openid (2.1.8) PATH remote: . specs: omniauth-openid (1.0.0.beta1) omniauth (~> 1.0.0.beta1) rack-openid (~> 1.3.1) GEM remote: http://rubygems.org/ specs: addressable (2.2.6) crack (0.3.1) diff-lcs (1.1.3) growl (1.0.3) guard (0.8.7) thor (~> 0.14.6) guard-rspec (0.5.0) guard (>= 0.8.4) hashie (1.2.0) multi_json (1.0.3) omniauth (1.0.0.pr2) hashie rack rack (1.3.5) rack-openid (1.3.1) rack (>= 1.1.0) ruby-openid (>= 2.1.8) rack-protection (1.1.2) rack rack-test (0.6.1) rack (>= 1.0) rake (0.9.2) rb-fsevent (0.4.3.1) rdiscount (1.6.8) rspec (2.7.0) rspec-core (~> 2.7.0) rspec-expectations (~> 2.7.0) rspec-mocks (~> 2.7.0) rspec-core (2.7.0) rspec-expectations (2.7.0) diff-lcs (~> 1.1.2) rspec-mocks (2.7.0) simplecov (0.5.4) multi_json (~> 1.0.3) simplecov-html (~> 0.5.3) simplecov-html (0.5.3) sinatra (1.3.0) rack (~> 1.3) rack-protection (~> 1.1) tilt (~> 1.3) thor (0.14.6) tilt (1.3.3) webmock (1.7.7) addressable (> 2.2.5, ~> 2.2) crack (>= 0.1.7) yard (0.7.2) PLATFORMS ruby DEPENDENCIES growl guard guard-rspec jruby-openssl (~> 0.7) omniauth-openid! rack-test (~> 0.5) rake (~> 0.8) rb-fsevent rdiscount (~> 1.6) rspec (~> 2.5) ruby-openid (= 2.1.8)! simplecov (~> 0.4) sinatra webmock (~> 1.7) yard (~> 0.7) ruby-omniauth-openid-1.0.1/Guardfile 0000664 0000000 0000000 00000000372 12150423572 0017420 0 ustar 00root root 0000000 0000000 # A sample Guardfile # More info at https://github.com/guard/guard#readme guard 'rspec', :version => 2 do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec" } end ruby-omniauth-openid-1.0.1/LICENSE 0000664 0000000 0000000 00000002072 12150423572 0016577 0 ustar 00root root 0000000 0000000 Copyright (c) 2010-2011 Michael Bleigh and Intridea, Inc. 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: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ruby-omniauth-openid-1.0.1/README.md 0000664 0000000 0000000 00000004635 12150423572 0017060 0 ustar 00root root 0000000 0000000 # OmniAuth::OpenID Provides strategies for authenticating to providers using the OpenID standard. ## Installation gem install omniauth-openid ## Stand-Alone Example Use the strategy as a middleware in your application: require 'omniauth-openid' require 'openid/store/filesystem' use Rack::Session::Cookie use OmniAuth::Strategies::OpenID, :store => OpenID::Store::Filesystem.new('/tmp') Then simply direct users to `/auth/open_id` to prompt them for their OpenID identifier. You may also pre-set the identifier by passing an `identifier` parameter to the URL (Example: `/auth/open_id?openid_url=yahoo.com`). A list of all OpenID stores is available at http://github.com/openid/ruby-openid/tree/master/lib/openid/store/ ## OmniAuth Builder If OpenID is one of several authentication strategies, use the OmniAuth Builder: require 'omniauth-openid' require 'openid/store/filesystem' use OmniAuth::Builder do provider :open_id, :store => OpenID::Store::Filesystem.new('/tmp') end ## Configured Identifiers You may pre-configure an OpenID identifier. For example, to use Google's main OpenID endpoint: use OmniAuth::Builder do provider :open_id, :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id' end Note the use of nil, which will trigger ruby-openid's default Memory Store. ## License Copyright (c) 2011 Michael Bleigh and Intridea, Inc. 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: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ruby-omniauth-openid-1.0.1/Rakefile 0000664 0000000 0000000 00000000236 12150423572 0017237 0 ustar 00root root 0000000 0000000 require 'bundler' Bundler::GemHelper.install_tasks require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) task :default => :spec task :test => :spec ruby-omniauth-openid-1.0.1/examples/ 0000775 0000000 0000000 00000000000 12150423572 0017407 5 ustar 00root root 0000000 0000000 ruby-omniauth-openid-1.0.1/examples/sinatra.rb 0000664 0000000 0000000 00000001066 12150423572 0021400 0 ustar 00root root 0000000 0000000 require 'rubygems' require 'bundler' Bundler.setup :default, :development, :example require 'sinatra' require 'omniauth-openid' require 'openid/store/filesystem' use Rack::Session::Cookie use OmniAuth::Builder do provider :open_id, store: OpenID::Store::Filesystem.new('/tmp') end get '/' do <<-HTML
HTML end [:get, :post].each do |method| send method, '/auth/:provider/callback' do content_type 'text/plain' request.env['omniauth.auth'].info.to_hash.inspect end end ruby-omniauth-openid-1.0.1/lib/ 0000775 0000000 0000000 00000000000 12150423572 0016337 5 ustar 00root root 0000000 0000000 ruby-omniauth-openid-1.0.1/lib/omniauth-openid.rb 0000664 0000000 0000000 00000000110 12150423572 0021754 0 ustar 00root root 0000000 0000000 require 'omniauth-openid/version' require 'omniauth/strategies/open_id' ruby-omniauth-openid-1.0.1/lib/omniauth-openid/ 0000775 0000000 0000000 00000000000 12150423572 0021437 5 ustar 00root root 0000000 0000000 ruby-omniauth-openid-1.0.1/lib/omniauth-openid/version.rb 0000664 0000000 0000000 00000000100 12150423572 0023440 0 ustar 00root root 0000000 0000000 module OmniAuth module OpenID VERSION = '1.0.1' end end ruby-omniauth-openid-1.0.1/lib/omniauth/ 0000775 0000000 0000000 00000000000 12150423572 0020163 5 ustar 00root root 0000000 0000000 ruby-omniauth-openid-1.0.1/lib/omniauth/strategies/ 0000775 0000000 0000000 00000000000 12150423572 0022335 5 ustar 00root root 0000000 0000000 ruby-omniauth-openid-1.0.1/lib/omniauth/strategies/open_id.rb 0000664 0000000 0000000 00000010413 12150423572 0024276 0 ustar 00root root 0000000 0000000 require 'omniauth' require 'rack/openid' require 'openid/store/memory' module OmniAuth module Strategies # OmniAuth strategy for connecting via OpenID. This allows for connection # to a wide variety of sites, some of which are listed [on the OpenID website](http://openid.net/get-an-openid/). class OpenID include OmniAuth::Strategy AX = { :email => 'http://axschema.org/contact/email', :name => 'http://axschema.org/namePerson', :nickname => 'http://axschema.org/namePerson/friendly', :first_name => 'http://axschema.org/namePerson/first', :last_name => 'http://axschema.org/namePerson/last', :city => 'http://axschema.org/contact/city/home', :state => 'http://axschema.org/contact/state/home', :website => 'http://axschema.org/contact/web/default', :image => 'http://axschema.org/media/image/aspect11' } option :name, :open_id option :required, [AX[:email], AX[:name], AX[:first_name], AX[:last_name], 'email', 'fullname'] option :optional, [AX[:nickname], AX[:city], AX[:state], AX[:website], AX[:image], 'postcode', 'nickname'] option :store, ::OpenID::Store::Memory.new option :identifier, nil option :identifier_param, 'openid_url' def dummy_app lambda{|env| [401, {"WWW-Authenticate" => Rack::OpenID.build_header( :identifier => identifier, :return_to => callback_url, :required => options.required, :optional => options.optional, :method => 'post' )}, []]} end def identifier i = options.identifier || request.params[options.identifier_param.to_s] i = nil if i == '' i end def request_phase identifier ? start : get_identifier end def start openid = Rack::OpenID.new(dummy_app, options[:store]) response = openid.call(env) case env['rack.openid.response'] when Rack::OpenID::MissingResponse, Rack::OpenID::TimeoutResponse fail!(:connection_failed) else response end end def get_identifier f = OmniAuth::Form.new(:title => 'OpenID Authentication') f.label_field('OpenID Identifier', options.identifier_param) f.input_field('url', options.identifier_param) f.to_response end uid { openid_response.display_identifier } info do sreg_user_info.merge(ax_user_info) end extra do {'response' => openid_response} end def callback_phase return fail!(:invalid_credentials) unless openid_response && openid_response.status == :success super end def openid_response unless @openid_response openid = Rack::OpenID.new(lambda{|env| [200,{},[]]}, options[:store]) openid.call(env) @openid_response = env.delete('rack.openid.response') end @openid_response end def sreg_user_info sreg = ::OpenID::SReg::Response.from_success_response(openid_response) return {} unless sreg { 'email' => sreg['email'], 'name' => sreg['fullname'], 'location' => sreg['postcode'], 'nickname' => sreg['nickname'] }.reject{|k,v| v.nil? || v == ''} end def ax_user_info ax = ::OpenID::AX::FetchResponse.from_success_response(openid_response) return {} unless ax { 'email' => ax.get_single(AX[:email]), 'first_name' => ax.get_single(AX[:first_name]), 'last_name' => ax.get_single(AX[:last_name]), 'name' => (ax.get_single(AX[:name]) || [ax.get_single(AX[:first_name]), ax.get_single(AX[:last_name])].join(' ')).strip, 'location' => ("#{ax.get_single(AX[:city])}, #{ax.get_single(AX[:state])}" if Array(ax.get_single(AX[:city])).any? && Array(ax.get_single(AX[:state])).any?), 'nickname' => ax.get_single(AX[:nickname]), 'urls' => ({'Website' => Array(ax.get_single(AX[:website])).first} if Array(ax.get_single(AX[:website])).any?) }.inject({}){|h,(k,v)| h[k] = Array(v).first; h}.reject{|k,v| v.nil? || v == ''} end end end end OmniAuth.config.add_camelization 'openid', 'OpenID' OmniAuth.config.add_camelization 'open_id', 'OpenID' ruby-omniauth-openid-1.0.1/lib/omniauth/strategies/steam.rb 0000664 0000000 0000000 00000003452 12150423572 0023777 0 ustar 00root root 0000000 0000000 require 'omniauth/openid' module OmniAuth module Strategies class Steam < OmniAuth::Strategies::OpenID def initialize(app, store = nil, api_key = nil, options = {}, &block) options[:identifier] ||= "http://steamcommunity.com/openid" options[:name] ||= 'steam' @api_key = api_key super(app, store, options, &block) end def user_info(response=nil) player = user_hash['response']['players']['player'].first nickname = player["personaname"] name = player["realname"] url = player["profileurl"] country = player["loccountrycode"] state = player["locstatecode"] city = player["loccityid"] { 'nickname' => nickname, 'name' => name, 'url' => url, 'location' => "#{city}, #{state}, #{country}" } end def user_hash # Steam provides no information back on a openid response other than a 64bit user id # Need to use this information and make a API call to get user information from steam. if @api_key unless @user_hash uri = URI.parse("http://api.steampowered.com/") req = Net::HTTP::Get.new("#{uri.path}ISteamUser/GetPlayerSummaries/v0001/?key=#{@api_key}&steamids=#{@openid_response.display_identifier.split("/").last}") res = Net::HTTP.start(uri.host, uri.port) {|http| http.request(req) } end @user_hash ||= MultiJson.decode(res.body) else {} end end def auth_hash OmniAuth::Utils.deep_merge(super, { 'uid' => @openid_response.display_identifier.split("/").last, 'user_info' => user_info, 'extra' => {'user_hash' => user_hash} }) end end end end ruby-omniauth-openid-1.0.1/metadata.yml 0000664 0000000 0000000 00000007717 12150423572 0020110 0 ustar 00root root 0000000 0000000 --- !ruby/object:Gem::Specification name: omniauth-openid version: !ruby/object:Gem::Version version: 1.0.1 prerelease: platform: ruby authors: - Michael Bleigh - Erik Michaels-Ober autorequire: bindir: bin cert_chain: [] date: 2011-11-04 00:00:00.000000000Z dependencies: - !ruby/object:Gem::Dependency name: omniauth requirement: &70221645863580 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version version: '1.0' type: :runtime prerelease: false version_requirements: *70221645863580 - !ruby/object:Gem::Dependency name: rack-openid requirement: &70221645858920 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version version: 1.3.1 type: :runtime prerelease: false version_requirements: *70221645858920 - !ruby/object:Gem::Dependency name: rack-test requirement: &70221645855080 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version version: '0.5' type: :development prerelease: false version_requirements: *70221645855080 - !ruby/object:Gem::Dependency name: rake requirement: &70221645849280 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version version: '0.8' type: :development prerelease: false version_requirements: *70221645849280 - !ruby/object:Gem::Dependency name: rdiscount requirement: &70221645846800 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version version: '1.6' type: :development prerelease: false version_requirements: *70221645846800 - !ruby/object:Gem::Dependency name: rspec requirement: &70221645842660 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version version: '2.7' type: :development prerelease: false version_requirements: *70221645842660 - !ruby/object:Gem::Dependency name: simplecov requirement: &70221645838580 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version version: '0.4' type: :development prerelease: false version_requirements: *70221645838580 - !ruby/object:Gem::Dependency name: webmock requirement: &70221645833400 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version version: '1.7' type: :development prerelease: false version_requirements: *70221645833400 - !ruby/object:Gem::Dependency name: yard requirement: &70221645830920 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version version: '0.7' type: :development prerelease: false version_requirements: *70221645830920 description: OpenID strategy for OmniAuth. email: - michael@intridea.com - sferik@gmail.com executables: [] extensions: [] extra_rdoc_files: [] files: - .gemtest - .gitignore - .rspec - .yardopts - Gemfile - Gemfile.lock - Guardfile - LICENSE - README.md - Rakefile - examples/sinatra.rb - lib/omniauth-openid.rb - lib/omniauth-openid/version.rb - lib/omniauth/strategies/open_id.rb - lib/omniauth/strategies/steam.rb - omniauth-openid.gemspec - spec/omniauth/strategies/open_id_spec.rb - spec/spec_helper.rb homepage: https://github.com/intridea/omniauth-openid licenses: [] post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement none: false requirements: - - ! '>=' - !ruby/object:Gem::Version version: 1.3.6 requirements: [] rubyforge_project: rubygems_version: 1.8.10 signing_key: specification_version: 3 summary: OpenID strategy for OmniAuth. test_files: - spec/omniauth/strategies/open_id_spec.rb - spec/spec_helper.rb ruby-omniauth-openid-1.0.1/omniauth-openid.gemspec 0000664 0000000 0000000 00000002233 12150423572 0022236 0 ustar 00root root 0000000 0000000 # encoding: utf-8 require File.expand_path('../lib/omniauth-openid/version', __FILE__) Gem::Specification.new do |gem| gem.add_dependency 'omniauth', '~> 1.0' gem.add_dependency 'rack-openid', '~> 1.3.1' gem.add_development_dependency 'rack-test', '~> 0.5' gem.add_development_dependency 'rake', '~> 0.8' gem.add_development_dependency 'rdiscount', '~> 1.6' gem.add_development_dependency 'rspec', '~> 2.7' gem.add_development_dependency 'simplecov', '~> 0.4' gem.add_development_dependency 'webmock', '~> 1.7' gem.add_development_dependency 'yard', '~> 0.7' gem.authors = ['Michael Bleigh', 'Erik Michaels-Ober'] gem.description = %q{OpenID strategy for OmniAuth.} gem.email = ['michael@intridea.com', 'sferik@gmail.com'] gem.files = `git ls-files`.split("\n") gem.homepage = 'https://github.com/intridea/omniauth-openid' gem.name = 'omniauth-openid' gem.require_paths = ['lib'] gem.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if gem.respond_to? :required_rubygems_version= gem.summary = gem.description gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") gem.version = OmniAuth::OpenID::VERSION end ruby-omniauth-openid-1.0.1/spec/ 0000775 0000000 0000000 00000000000 12150423572 0016523 5 ustar 00root root 0000000 0000000 ruby-omniauth-openid-1.0.1/spec/omniauth/ 0000775 0000000 0000000 00000000000 12150423572 0020347 5 ustar 00root root 0000000 0000000 ruby-omniauth-openid-1.0.1/spec/omniauth/strategies/ 0000775 0000000 0000000 00000000000 12150423572 0022521 5 ustar 00root root 0000000 0000000 ruby-omniauth-openid-1.0.1/spec/omniauth/strategies/open_id_spec.rb 0000664 0000000 0000000 00000006606 12150423572 0025505 0 ustar 00root root 0000000 0000000 require 'spec_helper' require 'rack/openid' require 'omniauth-openid' describe OmniAuth::Strategies::OpenID, :type => :strategy do def app strat = OmniAuth::Strategies::OpenID Rack::Builder.new { use Rack::Session::Cookie use strat run lambda {|env| [404, {'Content-Type' => 'text/plain'}, [nil || env.key?('omniauth.auth').to_s]] } }.to_app end def expired_query_string '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' end describe '/auth/open_id without an identifier URL' do before do get '/auth/open_id' end it 'should respond with OK' do last_response.should be_ok end it 'should respond with HTML' do last_response.content_type.should == 'text/html' end it 'should render an identifier URL input' do last_response.body.should =~ %r{]*openid_url} end end #describe '/auth/open_id with an identifier URL' do # context 'successful' do # before do # @identifier_url = 'http://me.example.org' # # TODO: change this mock to actually return some sort of OpenID response # stub_request(:get, @identifier_url) # get '/auth/open_id?openid_url=' + @identifier_url # end # # it 'should redirect to the OpenID identity URL' do # last_response.should be_redirect # last_response.headers['Location'].should =~ %r{^#{@identifier_url}.*} # end # # it 'should tell the OpenID server to return to the callback URL' do # return_to = CGI.escape(last_request.url + '/callback') # last_response.headers['Location'].should =~ %r{[\?&]openid.return_to=#{return_to}} # end # end #end describe 'followed by /auth/open_id/callback' do context 'successful' do #before do # @identifier_url = 'http://me.example.org' # # TODO: change this mock to actually return some sort of OpenID response # stub_request(:get, @identifier_url) # get '/auth/open_id/callback' #end it "should set provider to open_id" it "should create auth_hash based on sreg" it "should create auth_hash based on ax" #it 'should call through to the master app' do # last_response.body.should == 'true' #end end context 'unsuccessful' do describe 'returning with expired credentials' do before do # get '/auth/open_id/callback?' + expired_query_string end it 'it should redirect to invalid credentials' do pending last_response.should be_redirect last_response.headers['Location'].should =~ %r{invalid_credentials} end end end end end ruby-omniauth-openid-1.0.1/spec/spec_helper.rb 0000664 0000000 0000000 00000000415 12150423572 0021341 0 ustar 00root root 0000000 0000000 $:.unshift File.dirname(__FILE__) + '/../lib' require 'simplecov' SimpleCov.start require 'rspec' require 'rack/test' require 'webmock/rspec' require 'omniauth-openid' RSpec.configure do |config| config.include WebMock::API config.include Rack::Test::Methods end