Spring Security - Is there a way to check if you're in a secured request?
I want to know if开发者_运维问答 the request I am in is accessible anonymously, even if I am authenticated anyways.
I think the easiest idea is to extend AuthenticatedVoter
and override its vote()
method to save a flag in a thread-local whenever ConfigAttribute happens to be IS_AUTHENTICATED_ANONYMOUSLY
. You can then inject your extended AuthenticatedVoter
into your Spring Security stack.
精彩评论