APY-13 : Complete the security gateway

Started the alternate implementation for gateway.