コード例 #1
0
ファイル: ServicesService.cs プロジェクト: robert0825/Scutex
        public Dictionary <License, List <LicenseSet> > GetServiceLicenses(Service service)
        {
            Dictionary <License, List <LicenseSet> > data = new Dictionary <License, List <LicenseSet> >();
            string mgmtToken = _packingService.PackToken(service.GetManagementToken());

            QueryActiveServiceProductsResult result = _serviceStatusProvider.GetActiveServiceProducts(service.ManagementUrl, mgmtToken,
                                                                                                      GetManagementStandardEncryptionInfo(service), service.GetManagementServiceKeyPair());

            if (IsResultValid(result))
            {
                foreach (var v in result.ProductsAndLicenseSets)
                {
                    License l = _licenseService.GetLicenseById(v.Id);

                    List <LicenseSet> sets = new List <LicenseSet>();

                    foreach (int i in v.SetIds)
                    {
                        sets.Add(_licenseSetService.GetLiceseSetById(i));
                    }

                    data.Add(l, sets);
                }
            }

            return(data);
        }
コード例 #2
0
        public QueryActiveServiceProductsResult GetActiveServiceProducts(string url, string token, EncryptionInfo encryptionInfo, KeyPair serviceKeys)
        {
            StatusServiceClient client = StatusServiceClientCreator(url);

            string encryptedToken = _symmetricEncryptionProvider.Encrypt(token, encryptionInfo);

            string encryptedResult = client.QueryActiveProductsAndLiceseSets(encryptedToken);
            string decryptedResult = _asymmetricEncryptionProvider.DecryptPublic(encryptedResult, serviceKeys);

            QueryActiveServiceProductsResult result = _objectSerializationProvider.Deserialize <QueryActiveServiceProductsResult>(decryptedResult);

            return(result);
        }
コード例 #3
0
ファイル: StatusService.cs プロジェクト: robert0825/Scutex
        public string QueryActiveProductsAndLiceseSets(string token)
        {
            QueryActiveServiceProductsResult result = new QueryActiveServiceProductsResult();

            try
            {
                if (!_controlService.ValidateManagementToken(token))
                {
                    result.WasOperationSuccessful = false;
                    result.WasRequestValid        = false;

                    return(_controlService.EncryptSymmetricResponse(_serializationProvider.Serialize(result)));
                }

                result.WasRequestValid = true;

                result.ProductsAndLicenseSets = new List <QueryActiveServiceProductsResultData>();
                List <ServiceProduct> products = _productManagementService.GetAllServicePorducts();

                foreach (ServiceProduct sp in products)
                {
                    List <int> liceseSets = new List <int>();

                    foreach (ServiceLicenseSet sls in sp.LicenseSets)
                    {
                        liceseSets.Add(sls.LicenseSetId);
                    }

                    QueryActiveServiceProductsResultData data = new QueryActiveServiceProductsResultData();
                    data.Id     = sp.LicenseId;
                    data.SetIds = liceseSets;

                    result.ProductsAndLicenseSets.Add(data);
                }

                result.WasOperationSuccessful = true;
            }
            catch (Exception ex)
            {
                result.WasException     = true;
                result.ExceptionMessage = ex.Message;                 // TODO: Must be modified to hide important data before release
            }

            return(_controlService.SerializeAndEncryptMgmtOutboundData(result));
        }