def load_current_users
      return if !@connect_current_user.nil?

      if @request.ssl? && @cookies.signed[:secure_user_id] != "secure#{@session[:user_id]}"
        sign_out! # hijacked
      else
        # If there is a session user_id, load up that user, otherwise set the anonymous user.
       
        if @session[:user_id]
          @connect_current_user = User.where(id: @session[:user_id]).first

          # It could happen (normally in development) that there is a session user_id that 
          # doesn't map to a User in the db.  In such a case, sign_out! to reset the state
          if @connect_current_user.nil?
            sign_out!
            return
          end
        else
          @connect_current_user = User.anonymous
        end

        # bring the app user inline with the connect user
        @app_current_user = user_provider.connect_user_to_app_user(@connect_current_user)
      end
    end
def load_current_users
      return if !@connect_current_user.nil?

      if @request.ssl? && @cookies.signed[:secure_user_id] != "secure#{@session[:user_id]}"
        sign_out! # hijacked
      else
        # If there is a session user_id, load up that user, otherwise set the anonymous user.
       
        if @session[:user_id]
          @connect_current_user = User.where(id: @session[:user_id]).first

          # It could happen (normally in development) that there is a session user_id that 
          # doesn't map to a User in the db.  In such a case, sign_out! to reset the state
          if @connect_current_user.nil?
            sign_out!
            return
          end
        else
          @connect_current_user = User.anonymous
        end

        # bring the app user inline with the connect user
        @app_current_user = user_provider.connect_user_to_app_user(@connect_current_user)
      end
    end
If they are nil (unset), sets the current users based on the session state