set gatewayId for security context