Ejemplo n.º 1
0
        public static void importCert(MMCoreConnector.WRMailBoxAccount.mailBoxAccount boxId, string fileLocation, string pinCode)
        {
            MMCoreConnector.WRMailBoxAccount.mailBoxAccount res;
            string id = boxId.id;

            MMCoreConnector.WRMailBoxAccount.mproxyOperationStatusAccount mosa = null;
            mosa = services.MMCoreServiceMailBoxAccount.readById(id);
            if (mosa.operationResult.Equals(MMCoreConnector.WRMailBoxAccount.mproxyOperationResult.MPROXY_RESULT_OK))
            {
                res = mosa.value[0];
                Console.WriteLine("importCert : account FOUND  " + res);
            }
            else
            {
                throw new Exception("Can't read the account. " + id);
            }
            res.pinCode   = (pinCode);
            boxId.pinCode = (pinCode);
            updateAccount(res);
            services.MMCoreServiceCertification.deleteKeyStore(id);
            services.MMCoreServiceCertification.createEmptyKeyStore(id, pinCode);
            MMCoreConnector.WRCertification.mproxyOperationStatus cres = services.MMCoreServiceCertification.importPKCS12KeyStore(id, pinCode, fileLocation);
            if (!cres.operationResult.Equals(MMCoreConnector.WRCertification.mproxyOperationResult.MPROXY_RESULT_OK))
            {
                throw new Exception("Can't import: " + id);
            }
        }
Ejemplo n.º 2
0
        public static MMCoreConnector.WRMailBoxAccount.mailBoxAccount readOrCreateMBAccount(string boxType, string type, string value, string applicationId)
        {
            MMCoreConnector.WRMailBoxAccount.mailBoxAccount res = null;
            Console.WriteLine("createLocalAccount. Type : " + type + "  Value: " + value + "  AppID:" + applicationId);
            string accId = generateMailBoxAccountId(boxType, type, value, applicationId);

            MMCoreConnector.WRMailBoxAccount.mproxyOperationStatusAccount mosa = null;
            MMCoreConnector.WRMailBoxAccount.mproxyOperationStatus        mos  = null;
            mosa = services.MMCoreServiceMailBoxAccount.readById(accId);
            if (mosa.operationResult.Equals(MMCoreConnector.WRMailBoxAccount.mproxyOperationResult.MPROXY_RESULT_OK))
            {
                res = mosa.value[0];
                Console.WriteLine("readOrCreateMBAccount : account FOUND  " + res);
            }
            else
            {
                Console.WriteLine("createLocalAccount : Account NOT FOUND. Creating...");
                mos = services.MMCoreServiceMailBoxAccount.createMailBox(boxType, type, value, applicationId);
                Console.WriteLine("createLocalAccount : " + value + " RES: " + mos.operationResult + "   INFO: " + mos.detailedInfo);
                if (mos.operationResult.Equals(MMCoreConnector.WRMailBoxAccount.mproxyOperationResult.MPROXY_RESULT_OK))
                {
                    Console.WriteLine("readOrCreateMBAccount : account was creted  ");
                }
                else
                {
                    throw new Exception("Can't create the account. " + mosa.detailedInfo);
                }
                mosa = services.MMCoreServiceMailBoxAccount.readById(accId);
                res  = mosa.value[0];
            }
            return(res);
        }
Ejemplo n.º 3
0
        private void setUpAcceptanceEnv(MMCoreConnector.WRMailBoxAccount.mailBoxAccount mba)
        {
            Console.WriteLine("Setting EH's acceptance env for " + mba);
            setMailBoxAccountProperty(mba, "MBAP_EHEALTH_ENV", "acceptance");
            updateAccount(mba);

            MMCoreConnector.WRMailBoxAccount.mproxyOperationStatusAccount mosa = services.MMCoreServiceMailBoxAccount.readById(mba.id);
            if (mosa.operationResult.Equals(MMCoreConnector.WRMailBoxAccount.mproxyOperationResult.MPROXY_RESULT_OK))
            {
                MMCoreConnector.WRMailBoxAccount.mailBoxAccount res = mosa.value[0];
                showAccount(res);
            }
        }
Ejemplo n.º 4
0
        private static bool verifyLocalAccountExist(MMCoreConnector.WRAccount.person person)
        {
            bool res = false;

            Console.WriteLine("verifyLocalAccountExist : " + person.login);
            MMCoreConnector.WRMailBoxAccount.mproxyOperationStatusAccount mosp = services.MMCoreServiceMailBoxAccount.readById(person.login);
            Console.WriteLine("verifyLocalAccountExist : " + person.login + "  IS: " + mosp.operationResult);
            if (mosp.operationResult.Equals(MMCoreConnector.WRMailBoxAccount.mproxyOperationResult.MPROXY_RESULT_OK))
            {
                if (mosp.detailedInfo.Equals("Successfully read"))
                {
                    Console.WriteLine("verifyLocalAccountExist : " + person.login + " FOUND!");
                    res = true;
                }
            }
            else
            {
                Console.WriteLine("verifyLocalAccountExist : " + person.login + " NOT FOUND...");
            }
            return(res);
        }
Ejemplo n.º 5
0
        private static void updateLocalAccountPassword(MMCoreConnector.WRAccount.person person)
        {
            MMCoreConnector.WRMailBoxAccount.mailBoxAccount accountLoc = null;

            MMCoreConnector.WRMailBoxAccount.mproxyOperationStatusAccount mosp = services.MMCoreServiceMailBoxAccount.readById(person.login);
            Console.WriteLine("verifyLocalAccountExist : " + person.login + "  IS: " + mosp.operationResult);
            if (mosp.operationResult.Equals(MMCoreConnector.WRMailBoxAccount.mproxyOperationResult.MPROXY_RESULT_OK))
            {
                if (mosp.detailedInfo.Equals("Successfully read"))
                {
                    accountLoc = mosp.value[0];
                    Console.WriteLine("updateLocalAccountPassword : "******" FOUND!");
                }
            }
            else
            {
                Console.WriteLine("updateLocalAccountPassword : "******" NOT FOUND...");
            }
            accountLoc.password = person.password;
            services.MMCoreServiceMailBoxAccount.update(accountLoc);
        }