# File lib/openid/server.rb, line 284
    def get_openid_response(http_method, args, is_authorized)
      http_method.upcase!

      case http_method
      when 'GET'
        trust_root = args['openid.trust_root']
        trust_root = args['openid.return_to'] if trust_root.nil?
        identity_url = args['openid.identity']
        if trust_root.nil? or identity_url.nil?
          authorized = false
        else
          authorized = is_authorized.call(identity_url, trust_root)
        end
        
        return get_auth_response(authorized, args)
        
      when 'POST'
        mode = args['openid.mode']

        if mode == 'associate'
          return associate(args)

        elsif mode == 'check_authentication'
          return check_authentication(args)

        else
          e = "Invalid openid.mode #{args['openid.mode']} for POST requests"
          return post_error(e)
        end

      else
        return [LOCAL_ERROR, "HTTP method #{http_method} not valid in OpenID"]
      end
    end