public static void ApplyCredentials(GitHubCredentials credentials, FluentHttpRequest request) { var map = new Dictionary <Type, CredentialVisitor>() { { typeof(AnonymousGitHubCredentials), new AnonymousGitHubCredentialsForFluentHttp() }, { typeof(GitHubUserCredentials), new GitHubUserCredentialsForFluentHttp() } }; var credentialApplier = (from item in map where item.Key == credentials.GetType() select item.Value).First(); credentialApplier.Apply(request, credentials); }
public void Apply(FluentHttpRequest request, GitHubCredentials credentials) { var userCreds = (GitHubUserCredentials)credentials; request.AuthenticateUsing(new HttpBasicAuthenticator(userCreds.Username, userCreds.Password)); }
public void Apply(FluentHttpRequest request, GitHubCredentials credentials) { }