APY-13 : Complete the security gateway

Centralized the path encoding.