private void UpdateFromCredential(ICredentialSet source, ISecurityOptions target) { if (source != null) { target.Credential = source.Id; var guardedSource = new GuardedCredential(source, this.PersistenceSecurity); var guardedTarget = new GuardedCredential(target, this.PersistenceSecurity); guardedTarget.Domain = guardedSource.Domain; guardedTarget.UserName = guardedSource.UserName; target.EncryptedPassword = source.EncryptedPassword; } }
private void UpdateFromDefaultValues(ICredentialBase target) { Settings settings = Settings.Instance; var guarded = new GuardedCredential(target, this.PersistenceSecurity); if (string.IsNullOrEmpty(guarded.Domain)) { guarded.Domain = settings.DefaultDomain; } if (string.IsNullOrEmpty(guarded.UserName)) { guarded.UserName = settings.DefaultUsername; } if (string.IsNullOrEmpty(guarded.Password)) { guarded.Password = settings.DefaultPassword; } }