S2S VPN: CS-15882: Only allow VPN connection between same account's gateways

This commit is contained in:
Sheng Yang 2012-08-07 13:42:54 -07:00
parent b5e1c53137
commit 5e0eb93fe6
1 changed files with 4 additions and 0 deletions

View File

@ -216,6 +216,10 @@ public class Site2SiteVpnManagerImpl implements Site2SiteVpnManager, Manager {
}
_accountMgr.checkAccess(caller, null, false, vpnGateway);
if (customerGateway.getAccountId() != vpnGateway.getAccountId() || customerGateway.getDomainId() != vpnGateway.getDomainId()) {
throw new InvalidParameterValueException("VPN connection can only be esitablished between same account's VPN gateway and customer gateway!");
}
if (_vpnConnectionDao.findByVpnGatewayIdAndCustomerGatewayId(vpnGatewayId, customerGatewayId) != null) {
throw new InvalidParameterValueException("The vpn connection with customer gateway id " + customerGatewayId + " or vpn gateway id "
+ vpnGatewayId + " already existed!");