check_for_fields (OpenID::Consumer::IdResHandler)

    # File lib/openid/consumer/idres.rb, line 104
          def check_for_fields
            # XXX: if a field is missing, we should not have to explicitly
            # check that it's present, just make sure that the fields are
            # actually being used by the rest of the code in
            # tests. Although, which fields are signed does need to be
            # checked somewhere.
            basic_fields = ['return_to', 'assoc_handle', 'sig', 'signed']
            basic_sig_fields = ['return_to', 'identity']

            case openid_namespace
            when OPENID2_NS
              require_fields = basic_fields + ['op_endpoint']
              require_sigs = basic_sig_fields +
                ['response_nonce', 'claimed_id', 'assoc_handle', 'op_endpoint']
            when OPENID1_NS
              require_fields = basic_fields + ['identity']
              require_sigs = basic_sig_fields
            else
              raise RuntimeError, "check_for_fields doesn't know about "\
                                  "namespace #{openid_namespace.inspect}"
            end

            require_fields.each do |field|
              if !@message.has_key?(OPENID_NS, field)
                raise ProtocolError, "Missing required field #{field}"
              end
            end

            require_sigs.each do |field|
              # Field is present and not in signed list
              if @message.has_key?(OPENID_NS, field) && !signed_list.member?(field)
                raise ProtocolError, "#{field.inspect} not signed"
              end
            end
          end