If you look at the documentation for token() you will see that this method is responsible
for extracting the authentication token from the request. So at this point, the authentication
is still in progress and there is no information regarding User and its role.
Could you please give us some details as to what you are trying to do? so we can help you better.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.