Fix for https://issues.infn.it/jira/browse/VOMS-418.
Refactored security contexts.