Is there builtin way to use protected AJAX endpoint?

Is there builtin way to use protected AJAX endpoint?