I am working on a similar thing and am getting the exact same problem. The securityCtx seems to exist if I login normally to the portal. However it is null while using my custom valve.
Have you found any solutions to this problem ? If so please help cos I'm stuck at this problem for really long.