2 // System.Net.NetworkCredential.cs
4 // Author: Duncan Mak (duncan@ximian.com)
5 // Author: Rolf Bjarne KVinge (rolf@xamarin.com)
8 // Copyright (C) 2010 Novell, Inc (http://www.novell.com)
9 // Copyright (C) 2011 Xamarin Inc (http://www.xamarin.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System.Security;
35 public class NetworkCredential : ICredentials
46 SecureString securePassword;
50 public NetworkCredential ()
54 public NetworkCredential (string userName, string password)
56 this.userName = userName;
57 this.password = password;
60 public NetworkCredential (string userName, string password, string domain)
62 this.userName = userName;
63 this.password = password;
69 public string Domain {
70 get { return domain ?? String.Empty; }
71 set { domain = value; }
74 public string UserName {
75 get { return userName ?? String.Empty; }
76 set { userName = value; }
79 public string Password {
80 get { return password ?? String.Empty; }
81 set { password = value; }
85 public SecureString SecurePassword {
86 get { return securePassword; }
89 securePassword = new SecureString ();
91 securePassword = value;
97 public NetworkCredential GetCredential (Uri uri, string authType)
103 public NetworkCredential GetCredential (string host, int port, string authenticationType)