IANAL - not a lawyer
I strongly doubt that writing your story as fan fiction gives you any
legal rights that you would not have otherwise. However, if the Star
War franchise has been tolerating fan fiction without taking any legal
action, you can draw two consequences:
the franchise is probably not likely to pick on you more than on
anyone else;
not enforcing for some time the prohibition of fan fiction weakens
their legal right to do it in your case, or at least to seek damages.
Other than that ...
If you take the characters, or the names used in Star Wars, this is
probably an infringement.
If it is just some ideas, you are probably not infringing. For
example, Ursula le Guin used in a novel a communication device called
the ansible. This was reused by other authors (Orson Scott Card), and
I do not know that anyone considered it plagiarism.
More generally you can quote other works, or make references to event
that occurred in other works without plagiarizing, and I guess without
infringing the copyright.
Reusing the precise setting of a work, as in fan fiction can be more
touchy. Some authors will not tolerate fan fiction. Others will not
mind.
One case is usually not considered copyright infringement : satyre.
If you reuse the characters (usually slightly misnamed) and the
setting of a well known novel or franchise to make a satyrical version
of it, that is allowed in the copyright law of many countries, as fair
use or under some other denomination.
Story ideas cannot be copyrighted by themselves, but if you use
someones story idea, you should make sure that your treatment of the
idea is really original.
One good principle that comes from academia. If you are reusing ideas
or other creatives contributions from another author, just be clear
about it, and say it explicitly somewhere (footnote, end notes,
... whatever). This will at least show you are not trying to cheat
anyone, that you do thing in good faith. Though, in principle, good
faith may not have legal value in many cases, it can still help a lot
mitigating legal conflicts.
If you are really creative, and clear about what you borrow, I doubt
anyone can accuse you of plagiarism. But recall that plagiarism and
copyright infringement are not necessarily the same. One is moral and
the other is legal.