# File lib/rack/auth/openid.rb, line 137
      def initialize(realm, options={})
        @realm = realm
        realm = URI(realm)
        if realm.path.empty?
          raise ArgumentError, "Invalid realm path: '#{realm.path}'"
        elsif not realm.absolute?
          raise ArgumentError, "Realm '#{@realm}' not absolute"
        end

        [:return_to, :login_good, :login_fail, :login_quit].each do |key|
          if options.key? key and luri = URI(options[key])
            if !luri.absolute?
              raise ArgumentError, ":#{key} is not an absolute uri: '#{luri}'"
            end
          end
        end

        if options[:return_to] and ruri = URI(options[:return_to])
          if ruri.path.empty?
            raise ArgumentError, "Invalid return_to path: '#{ruri.path}'"
          elsif realm.path != ruri.path[0, realm.path.size]
            raise ArgumentError, 'return_to not within realm.' \
          end
        end

        # TODO: extension support
        if extensions = options.delete(:extensions)
          extensions.each do |ext, args|
            add_extension ext, *args
          end
        end

        @options = {
          :session_key => 'rack.session',
          :openid_param => 'openid_identifier',
          #:return_to, :login_good, :login_fail, :login_quit
          #:no_session, :auth_fail, :error
          :store => OIDStore,
          :immediate => false,
          :anonymous => false,
          :catch_errors => false
        }.merge(options)
        @extensions = {}
      end