Most authors simply make a point to loudly proclaim their "Don't ask, don't tell" policy to the world, which is to say they don't mind if you write fanfic but you aren't allowed to send or talk about it to them and they won't read it if it's posted online.
A few authors have notably broken with...