/// <summary>Update this method with the credentials from the URIish.</summary> /// <remarks>Update this method with the credentials from the URIish.</remarks> /// <param name="uri">the URI used to create the connection.</param> /// <param name="credentialsProvider"> /// the credentials provider, or null. If provided, /// <see cref="URIish.GetPass()">credentials in the URI</see> /// are ignored. /// </param> /// <returns> /// true if the authentication method is able to provide /// authorization for the given URI /// </returns> internal virtual bool Authorize(URIish uri, CredentialsProvider credentialsProvider ) { string username; string password; if (credentialsProvider != null) { CredentialItem.Username u = new CredentialItem.Username(); CredentialItem.Password p = new CredentialItem.Password(); if (credentialsProvider.Supports(u, p) && credentialsProvider.Get(uri, u, p)) { username = u.GetValue(); password = new string(p.GetValue()); p.Clear(); } else { return(false); } } else { username = uri.GetUser(); password = uri.GetPass(); } if (username != null) { Authorize(username, password); return(true); } return(false); }
public virtual bool PromptPassword(string msg) { CredentialItem.Password p = new CredentialItem.Password(msg); if (provider.Get(uri, p)) { password = new string(p.GetValue()); return(true); } else { password = null; return(false); } }
public virtual bool PromptPassword(string msg) { CredentialItem.Password p = new CredentialItem.Password(msg); if (provider.Get(uri, p)) { password = new string(p.GetValue()); return true; } else { password = null; return false; } }
/// <summary>Update this method with the credentials from the URIish.</summary> /// <remarks>Update this method with the credentials from the URIish.</remarks> /// <param name="uri">the URI used to create the connection.</param> /// <param name="credentialsProvider"> /// the credentials provider, or null. If provided, /// <see cref="URIish.GetPass()">credentials in the URI</see> /// are ignored. /// </param> /// <returns> /// true if the authentication method is able to provide /// authorization for the given URI /// </returns> internal virtual bool Authorize(URIish uri, CredentialsProvider credentialsProvider ) { string username; string password; if (credentialsProvider != null) { CredentialItem.Username u = new CredentialItem.Username(); CredentialItem.Password p = new CredentialItem.Password(); if (credentialsProvider.Supports(u, p) && credentialsProvider.Get(uri, u, p)) { username = u.GetValue(); password = new string(p.GetValue()); p.Clear(); } else { return false; } } else { username = uri.GetUser(); password = uri.GetPass(); } if (username != null) { Authorize(username, password); return true; } return false; }