diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2005-10-18 03:56:27 +0400 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2005-10-18 03:56:27 +0400 |
commit | be12839075843e35c1d72b218faf2a4da4cd478d (patch) | |
tree | ddff6291a93951c5672f1ca86f539fa188048971 /mcs/class/System/Microsoft.Win32 | |
parent | 5b4778d9f397f91095fa6f81ce7f5f6ff1e8c839 (diff) |
2005-10-17 Sebastien Pouliot <sebastien@ximian.com>
* IntranetZoneCredentialPolicy.cs: New. Implemented (2.0). This class
decide if the credentials should be sent if the sepcified uri is in
the intranet zone.
svn path=/trunk/mcs/; revision=51838
Diffstat (limited to 'mcs/class/System/Microsoft.Win32')
-rw-r--r-- | mcs/class/System/Microsoft.Win32/ChangeLog | 6 | ||||
-rw-r--r-- | mcs/class/System/Microsoft.Win32/IntranetZoneCredentialPolicy.cs | 55 |
2 files changed, 61 insertions, 0 deletions
diff --git a/mcs/class/System/Microsoft.Win32/ChangeLog b/mcs/class/System/Microsoft.Win32/ChangeLog index 5eda58ef653..806e7e4fa89 100644 --- a/mcs/class/System/Microsoft.Win32/ChangeLog +++ b/mcs/class/System/Microsoft.Win32/ChangeLog @@ -1,3 +1,9 @@ +2005-10-17 Sebastien Pouliot <sebastien@ximian.com> + + * IntranetZoneCredentialPolicy.cs: New. Implemented (2.0). This class + decide if the credentials should be sent if the sepcified uri is in + the intranet zone. + 2005-10-17 Sebastien Pouliot <sebastien@ximian.com> * SessionSwitchReason.cs: Fixed start value of enum (no 0 item). diff --git a/mcs/class/System/Microsoft.Win32/IntranetZoneCredentialPolicy.cs b/mcs/class/System/Microsoft.Win32/IntranetZoneCredentialPolicy.cs new file mode 100644 index 00000000000..23b744bbded --- /dev/null +++ b/mcs/class/System/Microsoft.Win32/IntranetZoneCredentialPolicy.cs @@ -0,0 +1,55 @@ +// +// Microsoft.Win32.IntranetZoneCredentialPolicy 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; +using System.Net; +using System.Security; +using System.Security.Permissions; +using System.Security.Policy; + +namespace Microsoft.Win32 { + + public class IntranetZoneCredentialPolicy : ICredentialPolicy { + + [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)] + public IntranetZoneCredentialPolicy () + { + } + + public bool ShouldSendCredential (Uri challengeUri, WebRequest request, + NetworkCredential credential, IAuthenticationModule authenticationModule) + { + Zone z = Zone.CreateFromUrl (challengeUri.AbsoluteUri); + return (z.SecurityZone == SecurityZone.Intranet); + } + } +} + +#endif |