public GenericHostProvider(ICommandContext context, IBasicAuthentication basicAuth, IWindowsIntegratedAuthentication winAuth) : base(context) { EnsureArgument.NotNull(basicAuth, nameof(basicAuth)); EnsureArgument.NotNull(winAuth, nameof(winAuth)); _basicAuth = basicAuth; _winAuth = winAuth; }
public String Print(IBasicAuthentication basicAuthentication) { if (basicAuthentication == null) { throw new ArgumentNullException(nameof(basicAuthentication)); } var credentials = String.Format("{0}:{1}", basicAuthentication.Username, basicAuthentication.Password); var credentialsBase64 = base64Printer.Print(encoding.GetBytes(credentials)); return($"Basic {credentialsBase64}"); }
public static ICredential GetCredentials(this IBasicAuthentication basicAuth, string resource) { return(basicAuth.GetCredentials(resource, null)); }