From 33fde90bc263deb905f55f79ecdd643f7f0f9169 Mon Sep 17 00:00:00 2001 From: Michael Bleigh Date: Tue, 19 Oct 2010 09:36:11 -0500 Subject: [PATCH] Don't delete options in OmniAuth strategy. Closes #61. --- oa-openid/lib/omniauth/strategies/open_id.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/oa-openid/lib/omniauth/strategies/open_id.rb b/oa-openid/lib/omniauth/strategies/open_id.rb index 07237f5..3eaa207 100644 --- a/oa-openid/lib/omniauth/strategies/open_id.rb +++ b/oa-openid/lib/omniauth/strategies/open_id.rb @@ -4,6 +4,8 @@ require 'omniauth/openid' 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 @@ -23,14 +25,24 @@ module OmniAuth :image => 'http://axschema.org/media/image/aspect11' } + # @param app [Rack Application] Standard Rack middleware application argument. + # @param store [OpenID Store] The [OpenID Store](http://github.com/openid/ruby-openid/tree/master/lib/openid/store/) + # you wish to use. Defaults to OpenID::MemoryStore. + # @option options [Array] :required The identity fields that are required for the OpenID + # request. May be an ActiveExchange schema URL or an sreg identifier. + # @option options [Array] :optional The optional attributes for the OpenID request. May + # be ActiveExchange or sreg. + # @option options [Symbol, :open_id] :name The URL segment name for this provider. def initialize(app, store = nil, options = {}) - super(app, options.delete(:name) || :open_id) + super(app, options[:name] || :open_id) @options = options @options[:required] ||= [AX[:email], AX[:first_name], AX[:last_name], 'email', 'fullname'] @options[:optional] ||= [AX[:nickname], AX[:city], AX[:state], AX[:website], AX[:image], 'postcode', 'nickname'] @store = store end + protected + def dummy_app lambda{|env| [401, {"WWW-Authenticate" => Rack::OpenID.build_header( :identifier => identifier,