Ejemplo n.º 1
0
 public static string SetCredentialsToUrl(this string url, Credentials credentials)
 {
     if (credentials.IsNotDefined()) return url;
     const string pattern = "(.+//)(.*@)?(.+)";
     var match = Regex.Match(url, pattern);
     if (!match.Success) return url;
     return match.Groups[1] + credentials.UserName + ":" + credentials.Password + "@" + match.Groups[3];
 }
Ejemplo n.º 2
0
 public void SetCredentialsToUrlTest_UrlWithCredentials()
 {
     var url = @"http://*****:*****@someurl.com/rep";
     var credentials = new Credentials("user", "password");
     var result = url.SetCredentialsToUrl(credentials);
     Assert.AreEqual(@"http://*****:*****@someurl.com/rep", result);
 }
Ejemplo n.º 3
0
 public UserOptions()
 {
     BranchTags = new List<BranchTagInfo>();
     BranchLinks = new BranchLinkInfoList();
     UserCredentials = new Credentials();
 }