Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2005-06-23 21:17:05 +0400
committerSebastien Pouliot <sebastien@ximian.com>2005-06-23 21:17:05 +0400
commit0724c393fe5acc9546f57098fe47485e5638af9a (patch)
tree8254930a7f2b031e499fb203ffc19e7def297095 /mcs/class/corlib/System.Security.Policy
parent2cd0bdf55bccb29cb69fa4e40f3fd36b19b84fe5 (diff)
2005-06-23 Sebastien Pouliot <sebastien@ximian.com>
* ApplicationSecurityManager.cs: Added basic calls to MonoTrustManager * MonoTrustManager.cs: New. Default (non SWF) trust manager. svn path=/trunk/mcs/; revision=46440
Diffstat (limited to 'mcs/class/corlib/System.Security.Policy')
-rw-r--r--mcs/class/corlib/System.Security.Policy/ApplicationSecurityManager.cs29
-rw-r--r--mcs/class/corlib/System.Security.Policy/ChangeLog5
-rw-r--r--mcs/class/corlib/System.Security.Policy/MonoTrustManager.cs69
3 files changed, 96 insertions, 7 deletions
diff --git a/mcs/class/corlib/System.Security.Policy/ApplicationSecurityManager.cs b/mcs/class/corlib/System.Security.Policy/ApplicationSecurityManager.cs
index aafc23f6d15..69c9c62f444 100644
--- a/mcs/class/corlib/System.Security.Policy/ApplicationSecurityManager.cs
+++ b/mcs/class/corlib/System.Security.Policy/ApplicationSecurityManager.cs
@@ -29,6 +29,7 @@
#if NET_2_0
using System.Runtime.InteropServices;
+using System.Security.Permissions;
namespace System.Security.Policy {
@@ -42,24 +43,38 @@ namespace System.Security.Policy {
// properties
- [MonoTODO]
+ [MonoTODO ("(2.0) - replace MonoTrustManager with one inside SWF")]
public static IApplicationTrustManager ApplicationTrustManager {
- get { return _appTrustManager; }
+ [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
+ get {
+ if (_appTrustManager == null) {
+ _appTrustManager = new MonoTrustManager ();
+ }
+ return _appTrustManager;
+ }
}
- [MonoTODO]
public static ApplicationTrustCollection UserApplicationTrusts {
- get { return _userAppTrusts; }
+ get {
+ if (_userAppTrusts == null) {
+ _userAppTrusts = new ApplicationTrustCollection ();
+ }
+ return _userAppTrusts;
+ }
}
// methods
- [MonoTODO]
+ [MonoTODO ("(2.0) - probably incomplete, missing manifest support")]
+ [SecurityPermission (SecurityAction.Demand, ControlPolicy = true, ControlEvidence = true)]
public static bool DetermineApplicationTrust (ActivationContext activationContext, TrustManagerContext context)
{
+// FIXME: a null activationContext throw a NullReferenceException but calling directly the ApplicationTrustManager.DetermineApplicationTrust doesn't
if (activationContext == null)
- throw new ArgumentNullException ("activationContext");
- throw new NotImplementedException ();
+ throw new NullReferenceException ("activationContext");
+// throw new ArgumentNullException ("activationContext");
+ ApplicationTrust at = ApplicationTrustManager.DetermineApplicationTrust (activationContext, context);
+ return at.IsApplicationTrustedToRun;
}
}
}
diff --git a/mcs/class/corlib/System.Security.Policy/ChangeLog b/mcs/class/corlib/System.Security.Policy/ChangeLog
index 28b066d0eec..0669717e94a 100644
--- a/mcs/class/corlib/System.Security.Policy/ChangeLog
+++ b/mcs/class/corlib/System.Security.Policy/ChangeLog
@@ -1,3 +1,8 @@
+2005-06-23 Sebastien Pouliot <sebastien@ximian.com>
+
+ * ApplicationSecurityManager.cs: Added basic calls to MonoTrustManager
+ * MonoTrustManager.cs: New. Default (non SWF) trust manager.
+
2005-06-23 Sebastien Pouliot <sebastien@ximian.com>
* ApplicationDirectory.cs, CodeConnectAccess.cs, Hash.cs,
diff --git a/mcs/class/corlib/System.Security.Policy/MonoTrustManager.cs b/mcs/class/corlib/System.Security.Policy/MonoTrustManager.cs
new file mode 100644
index 00000000000..5e31f314d4b
--- /dev/null
+++ b/mcs/class/corlib/System.Security.Policy/MonoTrustManager.cs
@@ -0,0 +1,69 @@
+//
+// System.Security.Policy.MonoTrustManager internal class
+//
+// Author:
+// Sebastien Pouliot <sebastien@ximian.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System.Security;
+using System.Security.Permissions;
+
+namespace System.Security.Policy {
+
+ // this is temporary until we include one in SWF for 2.0
+
+ internal class MonoTrustManager : IApplicationTrustManager {
+
+ private const string tag = "IApplicationTrustManager";
+
+ [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
+ public ApplicationTrust DetermineApplicationTrust (ActivationContext activationContext, TrustManagerContext context)
+ {
+ if (activationContext == null)
+ throw new ArgumentNullException ("activationContext");
+ return null;
+ }
+
+ public void FromXml (SecurityElement e)
+ {
+ if (e == null)
+ throw new ArgumentNullException ("e");
+ if (e.Tag != tag)
+ throw new ArgumentException ("e", Locale.GetText ("Invalid XML tag."));
+ // nothing more to do in this case
+ }
+
+ public SecurityElement ToXml ()
+ {
+ SecurityElement se = new SecurityElement (tag);
+ se.AddAttribute ("class", typeof (MonoTrustManager).AssemblyQualifiedName);
+ se.AddAttribute ("version", "1");
+ return se;
+ }
+ }
+}
+
+#endif