The Labs \ Source Viewer \ SSCLI \ System.Security.Policy \ TrustManagerUIContext

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. //
  16. // IApplicationTrustManager.cs
  17. //
  18. namespace System.Security.Policy
  19. {
  20.    
  21.     //
  22.     // Interface that defines an IApplicationTrustManager. An IApplicationTrustManager handles application security decisions
  23.     // when there is no stored policy for that app, be this by prompting the user, checking a web service, or other means.
  24.     //
  25.    
  26.     [System.Runtime.InteropServices.ComVisible(true)]
  27.     public interface IApplicationTrustManager : ISecurityEncodable
  28.     {
  29.         ApplicationTrust DetermineApplicationTrust(ActivationContext activationContext, TrustManagerContext context);
  30.     }
  31.    
  32.     //
  33.     // This enumeration provides a hint to the trust manager as to the UI it should provide for the trust decision.
  34.     //
  35.    
  36.     [System.Runtime.InteropServices.ComVisible(true)]
  37.     public enum TrustManagerUIContext
  38.     {
  39.         Install,
  40.         Upgrade,
  41.         Run
  42.     }
  43.    
  44.     //
  45.    
  46.     [System.Runtime.InteropServices.ComVisible(true)]
  47.     public class TrustManagerContext
  48.     {
  49.         private bool m_ignorePersistedDecision;
  50.         private TrustManagerUIContext m_uiContext;
  51.         private bool m_noPrompt;
  52.         private bool m_keepAlive;
  53.         private bool m_persist;
  54.         private ApplicationIdentity m_appId;
  55.        
  56.         public TrustManagerContext() : this(TrustManagerUIContext.Run)
  57.         {
  58.         }
  59.        
  60.         public TrustManagerContext(TrustManagerUIContext uiContext)
  61.         {
  62.             m_ignorePersistedDecision = false;
  63.             m_uiContext = uiContext;
  64.             m_keepAlive = false;
  65.             m_persist = true;
  66.         }
  67.        
  68.         public virtual TrustManagerUIContext UIContext {
  69.             get { return m_uiContext; }
  70.             set { m_uiContext = value; }
  71.         }
  72.        
  73.         public virtual bool NoPrompt {
  74.             get { return m_noPrompt; }
  75.             set { m_noPrompt = value; }
  76.         }
  77.        
  78.         public virtual bool IgnorePersistedDecision {
  79.             get { return m_ignorePersistedDecision; }
  80.             set { m_ignorePersistedDecision = value; }
  81.         }
  82.        
  83.         public virtual bool KeepAlive {
  84.             get { return m_keepAlive; }
  85.             set { m_keepAlive = value; }
  86.         }
  87.        
  88.         public virtual bool Persist {
  89.             get { return m_persist; }
  90.             set { m_persist = value; }
  91.         }
  92.        
  93.         public virtual ApplicationIdentity PreviousApplicationIdentity {
  94.             get { return m_appId; }
  95.             set { m_appId = value; }
  96.         }
  97.     }
  98. }

Developer Fusion