コード例 #1
0
        public void SavePasswords()
        {
            //Save source control password
            if (!string.IsNullOrEmpty(UserProfile.SourceControlPass))
            {
                WinCredentialUtil.SetCredentials("Ginger_SourceControl_" + UserProfile.SourceControlType, UserProfile.SourceControlUser, UserProfile.SourceControlPass);
            }
            if (!string.IsNullOrEmpty(UserProfile.SolutionSourceControlPass))
            {
                WinCredentialUtil.SetCredentials("Ginger_SolutionSourceControl", UserProfile.SolutionSourceControlUser, UserProfile.SolutionSourceControlPass);
            }

            //Save ALM passwords on windows credential manager
            foreach (GingerCoreNET.ALMLib.ALMUserConfig almConfig in UserProfile.ALMUserConfigs.Where(f => !string.IsNullOrEmpty(f.ALMPassword)))
            {
                WinCredentialUtil.SetCredentials("Ginger_ALM_" + almConfig.AlmType, almConfig.ALMUserName, almConfig.ALMPassword);
            }
        }
コード例 #2
0
        public UserProfile LoadPasswords(UserProfile userProfile)
        {
            //Get sourcecontrol password
            if (!string.IsNullOrEmpty(userProfile.EncryptedSourceControlPass))
            {
                userProfile.SourceControlPass = EncryptionHandler.DecryptwithKey(userProfile.EncryptedSourceControlPass);
            }
            else
            {
                userProfile.SourceControlPass = WinCredentialUtil.GetCredential("Ginger_SourceControl_" + userProfile.SourceControlType);
            }

            if (!string.IsNullOrEmpty(userProfile.EncryptedSolutionSourceControlPass))
            {
                userProfile.SolutionSourceControlPass = EncryptionHandler.DecryptwithKey(userProfile.EncryptedSolutionSourceControlPass);
            }
            else
            {
                userProfile.SolutionSourceControlPass = WinCredentialUtil.GetCredential("Ginger_SolutionSourceControl");
            }


            //Get ALM passwords
            foreach (GingerCoreNET.ALMLib.ALMUserConfig almConfig in userProfile.ALMUserConfigs)
            {
                if (!string.IsNullOrEmpty(almConfig.EncryptedALMPassword))
                {
                    almConfig.ALMPassword = EncryptionHandler.DecryptwithKey(almConfig.EncryptedALMPassword);
                }
                else
                {
                    almConfig.ALMPassword = WinCredentialUtil.GetCredential("Ginger_ALM_" + almConfig.AlmType);
                }
            }

            return(userProfile);
        }