internal static ApplicationTrust DetermineApplicationTrustInternal(ActivationContext activationContext, TrustManagerContext context) { ApplicationTrustCollection applicationTrustCollection = new ApplicationTrustCollection(true); ApplicationTrust applicationTrust; if (context == null || !context.IgnorePersistedDecision) { applicationTrust = applicationTrustCollection[activationContext.Identity.FullName]; if (applicationTrust != null) { return(applicationTrust); } } applicationTrust = ApplicationSecurityManager.ApplicationTrustManager.DetermineApplicationTrust(activationContext, context); if (applicationTrust == null) { applicationTrust = new ApplicationTrust(activationContext.Identity); } applicationTrust.ApplicationIdentity = activationContext.Identity; if (applicationTrust.Persist) { applicationTrustCollection.Add(applicationTrust); } return(applicationTrust); }
public void RemoveRange(ApplicationTrustCollection trusts) { if (trusts == null) { throw new ArgumentNullException("trusts"); } int num = 0; try { foreach (ApplicationTrust trust in trusts) { this.Remove(trust); ++num; } } catch { for (int index = 0; index < num; ++index) { this.Add(trusts[index]); } throw; } }
internal static ApplicationTrust DetermineApplicationTrustInternal(ActivationContext activationContext, TrustManagerContext context) { ApplicationTrust trust = null; ApplicationTrustCollection trusts = new ApplicationTrustCollection(true); if ((context == null) || !context.IgnorePersistedDecision) { trust = trusts[activationContext.Identity.FullName]; if (trust != null) { return(trust); } } trust = ApplicationTrustManager.DetermineApplicationTrust(activationContext, context); if (trust == null) { trust = new ApplicationTrust(activationContext.Identity); } trust.ApplicationIdentity = activationContext.Identity; if (trust.Persist) { trusts.Add(trust); } return(trust); }
// // Internal // internal static ApplicationTrust DetermineApplicationTrustInternal(ActivationContext activationContext, TrustManagerContext context) { ApplicationTrust trust = null; ApplicationTrustCollection userTrusts = new ApplicationTrustCollection(true); // See if there is a persisted trust decision for this application. if ((context == null || !context.IgnorePersistedDecision)) { trust = userTrusts[activationContext.Identity.FullName]; if (trust != null) { return(trust); } } // There is no cached trust decision so invoke the trust manager. trust = ApplicationTrustManager.DetermineApplicationTrust(activationContext, context); if (trust == null) { trust = new ApplicationTrust(activationContext.Identity); } // make sure the application identity is correctly set. trust.ApplicationIdentity = activationContext.Identity; if (trust.Persist) { userTrusts.Add(trust); } return(trust); }
/// <summary>Gets the application trusts in the collection that match the specified application identity.</summary> /// <returns>An <see cref="T:System.Security.Policy.ApplicationTrustCollection" /> containing all matching <see cref="T:System.Security.Policy.ApplicationTrust" /> objects.</returns> /// <param name="applicationIdentity">An <see cref="T:System.ApplicationIdentity" /> object describing the application to find.</param> /// <param name="versionMatch">One of the <see cref="T:System.Security.Policy.ApplicationVersionMatch" /> values. </param> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" /> /// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" /> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence, ControlPolicy" /> /// </PermissionSet> public ApplicationTrustCollection Find(ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch) { if (applicationIdentity == null) { throw new ArgumentNullException("applicationIdentity"); } string text = applicationIdentity.FullName; if (versionMatch != ApplicationVersionMatch.MatchExactVersion) { if (versionMatch != ApplicationVersionMatch.MatchAllVersions) { throw new ArgumentException("versionMatch"); } int num = text.IndexOf(", Version="); if (num >= 0) { text = text.Substring(0, num); } } ApplicationTrustCollection applicationTrustCollection = new ApplicationTrustCollection(); foreach (object obj in this._list) { ApplicationTrust applicationTrust = (ApplicationTrust)obj; if (applicationTrust.ApplicationIdentity.FullName.StartsWith(text)) { applicationTrustCollection.Add(applicationTrust); } } return(applicationTrustCollection); }
public void AddRange(ApplicationTrustCollection trusts) { if (trusts == null) { throw new ArgumentNullException("trusts"); } int num = 0; try { ApplicationTrustEnumerator enumerator = trusts.GetEnumerator(); while (enumerator.MoveNext()) { ApplicationTrust current = enumerator.Current; this.Add(current); num++; } } catch { for (int i = 0; i < num; i++) { this.Remove(trusts[i]); } throw; } }
/// <summary>Removes all application trust objects that match the specified criteria from the collection.</summary> /// <param name="applicationIdentity">The <see cref="T:System.ApplicationIdentity" /> of the <see cref="T:System.Security.Policy.ApplicationTrust" /> object to be removed.</param> /// <param name="versionMatch">One of the <see cref="T:System.Security.Policy.ApplicationVersionMatch" /> values.</param> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" /> /// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" /> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence, ControlPolicy" /> /// </PermissionSet> public void Remove(ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch) { ApplicationTrustCollection applicationTrustCollection = this.Find(applicationIdentity, versionMatch); foreach (ApplicationTrust trust in applicationTrustCollection) { this.RemoveAllInstances(trust); } }
public void Remove(ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch) { ApplicationTrustCollection coll = Find(applicationIdentity, versionMatch); foreach (ApplicationTrust t in coll) { RemoveAllInstances(t); } }
/// <summary>Removes the application trust objects in the specified collection from the collection.</summary> /// <param name="trusts">An <see cref="T:System.Security.Policy.ApplicationTrustCollection" /> that contains items to be removed from the currentcollection.</param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="trusts" /> is null. </exception> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence, ControlPolicy" /> /// </PermissionSet> public void RemoveRange(ApplicationTrustCollection trusts) { if (trusts == null) { throw new ArgumentNullException("trusts"); } foreach (ApplicationTrust trust in trusts) { this.RemoveAllInstances(trust); } }
public ApplicationTrust this[string appFullName] { get { ApplicationIdentity identity = new ApplicationIdentity(appFullName); ApplicationTrustCollection appTrusts = Find(identity, ApplicationVersionMatch.MatchExactVersion); if (appTrusts.Count > 0) { return(appTrusts[0]); } return(null); } }
public ApplicationTrust this[string appFullName] { [System.Security.SecurityCritical] // auto-generated get { ApplicationIdentity identity = new ApplicationIdentity(appFullName); ApplicationTrustCollection appTrusts = Find(identity, ApplicationVersionMatch.MatchExactVersion); if (appTrusts.Count > 0) { return(appTrusts[0]); } return(null); } }
public ApplicationTrustCollection Find(ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch) { ApplicationTrustCollection applicationTrustCollection = new ApplicationTrustCollection(false); foreach (ApplicationTrust applicationTrust in this) { if (CmsUtils.CompareIdentities(applicationTrust.ApplicationIdentity, applicationIdentity, versionMatch)) { applicationTrustCollection.Add(applicationTrust); } } return applicationTrustCollection; }
/// <summary>获取指定应用程序的 <see cref="T:System.Security.Policy.ApplicationTrust" /> 对象。</summary> /// <returns>指定应用程序的 <see cref="T:System.Security.Policy.ApplicationTrust" />,如果无法找到该对象则为 null。</returns> /// <param name="appFullName">应用程序的全名。</param> public ApplicationTrust this[string appFullName] { [SecurityCritical] get { ApplicationTrustCollection applicationTrustCollection = this.Find(new ApplicationIdentity(appFullName), ApplicationVersionMatch.MatchExactVersion); if (applicationTrustCollection.Count > 0) { return(applicationTrustCollection[0]); } return((ApplicationTrust)null); } }
public ApplicationTrust this[string appFullName] { [SecurityCritical] get { ApplicationIdentity applicationIdentity = new ApplicationIdentity(appFullName); ApplicationTrustCollection trusts = this.Find(applicationIdentity, ApplicationVersionMatch.MatchExactVersion); if (trusts.Count > 0) { return(trusts[0]); } return(null); } }
/// <summary>Copies the elements of the specified <see cref="T:System.Security.Policy.ApplicationTrustCollection" /> to the end of the collection.</summary> /// <param name="trusts">A <see cref="T:System.Security.Policy.ApplicationTrustCollection" /> containing the objects to add to the collection.</param> /// <exception cref="T:System.ArgumentNullException"> /// <paramref name="trusts" /> is null. </exception> /// <exception cref="T:System.ArgumentException">The <see cref="P:System.Security.Policy.ApplicationTrust.ApplicationIdentity" /> property of an <see cref="T:System.Security.Policy.ApplicationTrust" /> specified in <paramref name="trust" /> is null.</exception> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" /> /// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" /> /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence, ControlPolicy" /> /// </PermissionSet> public void AddRange(ApplicationTrustCollection trusts) { if (trusts == null) { throw new ArgumentNullException("trusts"); } foreach (ApplicationTrust applicationTrust in trusts) { if (applicationTrust.ApplicationIdentity == null) { throw new ArgumentException(Locale.GetText("ApplicationTrust.ApplicationIdentity can't be null."), "trust"); } this._list.Add(applicationTrust); } }
public ApplicationTrustCollection Find(ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch) { ApplicationTrustCollection trusts = new ApplicationTrustCollection(false); ApplicationTrustEnumerator enumerator = this.GetEnumerator(); while (enumerator.MoveNext()) { ApplicationTrust current = enumerator.Current; if (CmsUtils.CompareIdentities(current.ApplicationIdentity, applicationIdentity, versionMatch)) { trusts.Add(current); } } return(trusts); }
private static bool SearchPreviousTrustedVersion(ActivationContext activationContext, ApplicationIdentity previousAppId, out ArrayList matchingTrusts) { matchingTrusts = null; ApplicationTrustCollection userApplicationTrusts = ApplicationSecurityManager.UserApplicationTrusts; ApplicationTrustEnumerator enumerator = userApplicationTrusts.GetEnumerator(); while (enumerator.MoveNext()) { ApplicationTrust current = enumerator.Current; System.Deployment.Internal.Isolation.IDefinitionAppId id = System.Deployment.Internal.Isolation.IsolationInterop.AppIdAuthority.TextToDefinition(0, current.ApplicationIdentity.FullName); System.Deployment.Internal.Isolation.IDefinitionAppId id2 = System.Deployment.Internal.Isolation.IsolationInterop.AppIdAuthority.TextToDefinition(0, activationContext.Identity.FullName); if (System.Deployment.Internal.Isolation.IsolationInterop.AppIdAuthority.AreDefinitionsEqual(1, id, id2)) { if (matchingTrusts == null) { matchingTrusts = new ArrayList(); } matchingTrusts.Add(current); } } if (previousAppId != null) { ApplicationTrustEnumerator enumerator2 = userApplicationTrusts.GetEnumerator(); while (enumerator2.MoveNext()) { ApplicationTrust trust2 = enumerator2.Current; System.Deployment.Internal.Isolation.IDefinitionAppId id3 = System.Deployment.Internal.Isolation.IsolationInterop.AppIdAuthority.TextToDefinition(0, trust2.ApplicationIdentity.FullName); System.Deployment.Internal.Isolation.IDefinitionAppId id4 = System.Deployment.Internal.Isolation.IsolationInterop.AppIdAuthority.TextToDefinition(0, previousAppId.FullName); if (System.Deployment.Internal.Isolation.IsolationInterop.AppIdAuthority.AreDefinitionsEqual(1, id3, id4)) { if (matchingTrusts == null) { matchingTrusts = new ArrayList(); } matchingTrusts.Add(trust2); } } } return(matchingTrusts != null); }
public ApplicationTrustCollection Find(ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch) { if (applicationIdentity == null) { throw new ArgumentNullException("applicationIdentity"); } string fullname = applicationIdentity.FullName; switch (versionMatch) { case ApplicationVersionMatch.MatchAllVersions: int pos = fullname.IndexOf(", Version="); if (pos >= 0) { fullname = fullname.Substring(0, pos); } break; case ApplicationVersionMatch.MatchExactVersion: break; default: throw new ArgumentException("versionMatch"); } ApplicationTrustCollection coll = new ApplicationTrustCollection(); foreach (ApplicationTrust t in _list) { if (t.ApplicationIdentity.FullName.StartsWith(fullname)) { coll.Add(t); } } return(coll); }
public void RemoveRange(ApplicationTrustCollection trusts) { if (trusts == null) { throw new ArgumentNullException("trusts"); } int i = 0; try { foreach (ApplicationTrust trust in trusts) { Remove(trust); i++; } } catch { for (int j = 0; j < i; j++) { Add(trusts[j]); } throw; } }
[System.Security.SecurityCritical] // auto-generated public void AddRange(ApplicationTrustCollection trusts) { if (trusts == null) { throw new ArgumentNullException(nameof(trusts)); } Contract.EndContractBlock(); int i = 0; try { foreach (ApplicationTrust trust in trusts) { Add(trust); i++; } } catch { for (int j = 0; j < i; j++) { Remove(trusts[j]); } throw; } }
public void AddRange(ApplicationTrustCollection trusts) { if (trusts == null) { throw new ArgumentNullException("trusts"); } int num = 0; try { foreach (ApplicationTrust trust in trusts) { this.Add(trust); num++; } } catch { for (int i = 0; i < num; i++) { this.Remove(trusts[i]); } throw; } }
public void RemoveRange(ApplicationTrustCollection trusts) { }
[System.Security.SecurityCritical] // auto-generated internal ApplicationTrustEnumerator(ApplicationTrustCollection trusts) { m_trusts = trusts; m_current = -1; }
public void AddRange(ApplicationTrustCollection trusts) { }
public void RemoveRange(ApplicationTrustCollection trusts) { throw new NotImplementedException(); }
public ApplicationTrustCollection Find(ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch) { ApplicationTrustCollection trusts = new ApplicationTrustCollection(false); ApplicationTrustEnumerator enumerator = this.GetEnumerator(); while (enumerator.MoveNext()) { ApplicationTrust current = enumerator.Current; if (CmsUtils.CompareIdentities(current.ApplicationIdentity, applicationIdentity, versionMatch)) { trusts.Add(current); } } return trusts; }
[System.Security.SecurityCritical] // auto-generated public void Remove(ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch) { ApplicationTrustCollection collection = Find(applicationIdentity, versionMatch); RemoveRange(collection); }
public ApplicationTrustCollection Find (ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch) { if (applicationIdentity == null) throw new ArgumentNullException ("applicationIdentity"); string fullname = applicationIdentity.FullName; switch (versionMatch) { case ApplicationVersionMatch.MatchAllVersions: int pos = fullname.IndexOf (", Version="); if (pos >= 0) fullname = fullname.Substring (0, pos); break; case ApplicationVersionMatch.MatchExactVersion: break; default: throw new ArgumentException ("versionMatch"); } ApplicationTrustCollection coll = new ApplicationTrustCollection (); foreach (ApplicationTrust t in _list) { if (t.ApplicationIdentity.FullName.StartsWith (fullname)) { coll.Add (t); } } return coll; }
public void AddRange (ApplicationTrustCollection trusts) { if (trusts == null) throw new ArgumentNullException ("trusts"); foreach (ApplicationTrust t in trusts) { if (t.ApplicationIdentity == null) { throw new ArgumentException (Locale.GetText ( "ApplicationTrust.ApplicationIdentity can't be null."), "trust"); } _list.Add (t); } }
public void RemoveRange (ApplicationTrustCollection trusts) { if (trusts == null) throw new ArgumentNullException ("trusts"); foreach (ApplicationTrust t in trusts) { RemoveAllInstances (t); } }
internal ApplicationTrustEnumerator(ApplicationTrustCollection collection) { e = collection.GetEnumerator(); }
public void Remove(ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch) { ApplicationTrustCollection trusts = this.Find(applicationIdentity, versionMatch); this.RemoveRange(trusts); }
[System.Security.SecurityCritical] // auto-generated public ApplicationTrustCollection Find (ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch) { ApplicationTrustCollection collection = new ApplicationTrustCollection(false); foreach (ApplicationTrust trust in this) { if (CmsUtils.CompareIdentities(trust.ApplicationIdentity, applicationIdentity, versionMatch)) collection.Add(trust); } return collection; }
// // Internal // internal static ApplicationTrust DetermineApplicationTrustInternal (ActivationContext activationContext, TrustManagerContext context) { ApplicationTrust trust = null; ApplicationTrustCollection userTrusts = new ApplicationTrustCollection(true); // See if there is a persisted trust decision for this application. if ((context == null || !context.IgnorePersistedDecision)) { trust = userTrusts[activationContext.Identity.FullName]; if (trust != null) return trust; } // There is no cached trust decision so invoke the trust manager. trust = ApplicationTrustManager.DetermineApplicationTrust(activationContext, context); if (trust == null) trust = new ApplicationTrust(activationContext.Identity); // make sure the application identity is correctly set. trust.ApplicationIdentity = activationContext.Identity; if (trust.Persist) userTrusts.Add(trust); return trust; }
[System.Security.SecurityCritical] // auto-generated public void RemoveRange (ApplicationTrustCollection trusts) { if (trusts == null) throw new ArgumentNullException("trusts"); Contract.EndContractBlock(); int i = 0; try { foreach (ApplicationTrust trust in trusts) { Remove(trust); i++; } } catch { for (int j=0; j<i; j++) { Add(trusts[j]); } throw; } }
internal ApplicationTrustEnumerator (ApplicationTrustCollection collection) { e = collection.GetEnumerator (); }
internal static ApplicationTrust DetermineApplicationTrustInternal(ActivationContext activationContext, TrustManagerContext context) { ApplicationTrust trust = null; ApplicationTrustCollection trusts = new ApplicationTrustCollection(true); if ((context == null) || !context.IgnorePersistedDecision) { trust = trusts[activationContext.Identity.FullName]; if (trust != null) { return trust; } } trust = ApplicationTrustManager.DetermineApplicationTrust(activationContext, context); if (trust == null) { trust = new ApplicationTrust(activationContext.Identity); } trust.ApplicationIdentity = activationContext.Identity; if (trust.Persist) { trusts.Add(trust); } return trust; }
internal ApplicationTrustEnumerator(ApplicationTrustCollection atc) { trusts = atc; current = -1; }