コード例 #1
0
        private List <RmAttribute> getAttributeDefinition(string objectType, int cultureKey, string encryptionKey)
        {
            List <RmAttribute> attDef = null;

            if (cultureKey != 127)
            {
                string connString = ConfigManager.GetAppSetting("FIMDBConnectionString",
                                                                "Integrated Security=SSPI;Initial Catalog=FIMService;Data Source=localhost;");
                string adminAccountName = ConfigManager.GetAppSetting("FIMPortalAdminAccountName", string.Empty);
                string adminAccountPWD  = ConfigManager.GetAppSetting("FIMPortalAdminAccountPWD", string.Empty);

                OCG.ResourceManagement.DBAccess.ResourceReader resourceReader = null;
                if (string.IsNullOrEmpty(adminAccountName) || string.IsNullOrEmpty(adminAccountPWD))
                {
                    resourceReader = new OCG.ResourceManagement.DBAccess.ResourceReader(connString);
                }
                else
                {
                    resourceReader = new OCG.ResourceManagement.DBAccess.ResourceReader(
                        connString, adminAccountName, GenericAESCryption.DecryptString(adminAccountPWD, encryptionKey));
                }
                attDef = resourceReader.GetAttributes(objectType, cultureKey);
            }

            return(attDef);
        }
コード例 #2
0
        private ResourceManagementClient getClient(ConnectionInfo info)
        {
            ResourceManagementClient client = null;

            if (info == null)
            {
                client = new ResourceManagementClient();
            }
            else
            {
                NetworkCredential cred = null;
                if (!string.IsNullOrEmpty(info.Domain) &&
                    !string.IsNullOrEmpty(info.UserName) && !string.IsNullOrEmpty(info.Password))
                {
                    cred = new NetworkCredential(info.UserName,
                                                 GenericAESCryption.DecryptString(info.Password, info.EncryptionKey), info.Domain);
                }

                if (cred == null)
                {
                    client = string.IsNullOrEmpty(info.BaseAddress) ?
                             new ResourceManagementClient() : new ResourceManagementClient(info.BaseAddress);
                }
                else
                {
                    client = string.IsNullOrEmpty(info.BaseAddress) ?
                             new ResourceManagementClient(cred) : new ResourceManagementClient(info.BaseAddress, cred);
                }
            }

            return(client);
        }
コード例 #3
0
ファイル: AESCryptograph.cs プロジェクト: lulzzz/Excalibur
 public string Decrypt(string text, string key = null)
 {
     return(string.IsNullOrEmpty(key)?
            GenericAESCryption.DecryptString(text): GenericAESCryption.DecryptString(text, key));
 }
コード例 #4
0
ファイル: GenericController.cs プロジェクト: sagius-li/Lydia
        public IHttpActionResult GetEncryptionKey()
        {
            string key = ConfigManager.GetAppSetting("EncryptionKey", string.Empty);

            return(Ok(GenericAESCryption.EncryptString(key)));
        }