An Authentication object was not found in the SecurityContext – Spring 3.2.2

The security’s authorization check part gets the authenticated object from SecurityContext, which will be set when a request gets through the spring security filter. My assumption here is that soon after the login this is not being set. You probably can use a hack as given below to set the value.

try {
    SecurityContext ctx = SecurityContextHolder.createEmptyContext();

    //Do what ever you want to do

} finally {


Also you can have a look at the InteractiveAuthenticationSuccessEvent which will be called once the SecurityContext is set.

Leave a Comment