Get the security context at runtime to prevent circular dependencies