Add() public method

public Add ( ApplicationTrust trust ) : int
trust ApplicationTrust
return int
Exemplo n.º 1
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
        /// <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 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;
		}
Exemplo n.º 6
0
        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);
        }
        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);
        }
 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;
        }
Exemplo n.º 10
0
 [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;
 }
 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;
 }
		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;
		}