In which case, that's fine.
You implement getRestHeaders in your extension class, and list the headers that you want to use in your realm (example).
Then in your realm, in the token method, you can get access to that header through the ThreadContext (example).