def connect_current_user=(user)
      @connect_current_user = user || User.anonymous
      @app_current_user = user_provider.connect_user_to_app_user(@connect_current_user)

      if @connect_current_user.is_anonymous?
        @session[:user_id] = nil
        @cookies.delete(:secure_user_id)
      else
        @session[:user_id] = @connect_current_user.id
        @cookies.signed[:secure_user_id] = {secure: true, value: "secure#{@connect_current_user.id}"}
      end

      @connect_current_user
    end
def connect_current_user=(user)
      @connect_current_user = user || User.anonymous
      @app_current_user = user_provider.connect_user_to_app_user(@connect_current_user)

      if @connect_current_user.is_anonymous?
        @session[:user_id] = nil
        @cookies.delete(:secure_user_id)
      else
        @session[:user_id] = @connect_current_user.id
        @cookies.signed[:secure_user_id] = {secure: true, value: "secure#{@connect_current_user.id}"}
      end

      @connect_current_user
    end
Sets the current connect user, updates the app user, and also updates the
 session and cookie state.