public StatusRequestResult GetServiceStatus(string url, string token, EncryptionInfo encryptionInfo) { StatusServiceClient client = StatusServiceClientCreator(url); string encryptedToken = _symmetricEncryptionProvider.Encrypt(token, encryptionInfo); string serviceResult = client.GetServiceStatus(encryptedToken); string result = _symmetricEncryptionProvider.Decrypt(serviceResult, encryptionInfo); StatusRequestResult statusRequestResult = _objectSerializationProvider.Deserialize <StatusRequestResult>(result); return(statusRequestResult); }
public bool InitializeService(Service service) { string token = _packingService.PackToken(service.GetManagementToken()); StatusRequestResult statusResult = _serviceStatusProvider.GetServiceStatus(service.ManagementUrl, token, GetManagementStandardEncryptionInfo(service)); if (statusResult.IsInitialized == true) { return(false); } if (statusResult.IsActive == true) { return(false); } if (statusResult.IsRequestValid == false) { return(false); } MasterServiceData masterData = new MasterServiceData(); masterData.ServiceId = service.UniquePad; masterData.Token = service.Token; masterData.Initialized = true; masterData.ClientInboundKey = service.GetClientInboundKeyPart1(); masterData.ClientOutboundKey = service.GetClientOutboundKeyPart1(); masterData.ManagementInboundKey = service.GetManagementInboundKeyPart1(); masterData.ManagementOutboundKey = service.GetManagementOutboundKeyPart1(); InitializationResult result = _serviceStatusProvider.InitializeService(service.ManagementUrl, token, masterData, GetManagementStandardEncryptionInfo(service)); if (!result.WasInitializionSucessful) { return(false); } return(true); }
public string GetServiceStatus(string token) { StatusRequestResult result = new StatusRequestResult(); if (!_controlService.ValidateManagementToken(token)) { result.IsActive = false; result.IsInitialized = false; result.IsRequestValid = false; return(_controlService.EncryptSymmetricResponse(_serializationProvider.Serialize(result))); } MasterServiceData masterData = _masterService.GetMasterServiceData(); if (masterData == null) { result.IsActive = false; result.IsInitialized = false; result.IsRequestValid = true; } return(_controlService.EncryptSymmetricResponse(_serializationProvider.Serialize(result))); }