Пример #1
0
        /// <summary>The constructor with the username and password combined string argument.
        ///     </summary>
        /// <remarks>The constructor with the username and password combined string argument.
        ///     </remarks>
        /// <param name="usernamePassword">the username:password formed string</param>
        /// <seealso cref="ToString()">ToString()</seealso>
        public UsernamePasswordCredentials(string usernamePassword) : base()
        {
            Args.NotNull(usernamePassword, "Username:password string");
            int atColon = usernamePassword.IndexOf(':');

            if (atColon >= 0)
            {
                this.principal = new BasicUserPrincipal(Sharpen.Runtime.Substring(usernamePassword
                                                                                  , 0, atColon));
                this.password = Sharpen.Runtime.Substring(usernamePassword, atColon + 1);
            }
            else
            {
                this.principal = new BasicUserPrincipal(usernamePassword);
                this.password  = null;
            }
        }
Пример #2
0
 /// <summary>The constructor with the username and password arguments.</summary>
 /// <remarks>The constructor with the username and password arguments.</remarks>
 /// <param name="userName">the user name</param>
 /// <param name="password">the password</param>
 public UsernamePasswordCredentials(string userName, string password) : base()
 {
     Args.NotNull(userName, "Username");
     this.principal = new BasicUserPrincipal(userName);
     this.password  = password;
 }