/// <summary>
        /// Creates a new <see cref="BasicAuthentication"/> object with an underlying credential store.
        /// </summary>
        /// <param name="credentialStore">
        /// The <see cref="ICredentialStore"/> to delegate to.
        /// </param>
        /// <param name="ntlmSupport">
        /// <para>The level of NTLM support to be provided by this instance.</para>
        /// <para>If `<see cref="NtlmSupport.Always"/>` is used, the 
        /// `<paramref name="acquireCredentialsCallback"/>` and `<paramref name="acquireResultCallback"/>` 
        /// will be ignored by `<see cref="GetCredentials(TargetUri)"/>`.</para>
        /// </param>
        /// <param name="acquireCredentialsCallback">
        /// (optional) delegate for acquiring credentials.
        /// </param>
        /// <param name="acquireResultCallback">
        /// (optional) delegate for notification of acquisition results.
        /// </param>
        public BasicAuthentication(
            ICredentialStore credentialStore,
            NtlmSupport ntlmSupport,
            AcquireCredentialsDelegate acquireCredentialsCallback,
            AcquireResultDelegate acquireResultCallback)
        {
            if (credentialStore == null)
                throw new ArgumentNullException(nameof(credentialStore));

            _acquireCredentials = acquireCredentialsCallback;
            _acquireResult = acquireResultCallback;
            _credentialStore = credentialStore;
            _ntlmSupport = ntlmSupport;
        }
Пример #2
0
        /// <summary>
        /// Creates a new <see cref="BasicAuthentication"/> object with an underlying credential store.
        /// </summary>
        /// <param name="credentialStore">
        /// The <see cref="ICredentialStore"/> to delegate to.
        /// </param>
        /// <param name="acquireCredentialsCallback">
        /// (optional) delegate for acquiring credentials.
        /// </param>
        /// <param name="acquireResultCallback">
        /// (optional) delegate for notification of acquisition results.
        /// </param>
        public BasicAuthentication(
            ICredentialStore credentialStore,
            AcquireCredentialsDelegate acquireCredentialsCallback,
            AcquireResultDelegate acquireResultCallback)
        {
            if (credentialStore == null)
            {
                throw new ArgumentNullException(nameof(credentialStore));
            }

            _acquireCredentials = acquireCredentialsCallback;
            _acquireResult      = acquireResultCallback;
            _credentialStore    = credentialStore;
        }
        /// <summary>
        /// Creates a new `<see cref="BasicAuthentication"/>` object with an underlying credential store.
        /// </summary>
        /// <param name="credentialStore">The `<see cref="ICredentialStore"/>` to delegate to.</param>
        /// <param name="ntlmSupport">
        /// /The level of NTLM support to be provided by this instance./
        /// <para/>
        /// If ` <see cref="NtlmSupport.Always"/>` is used, the `<paramref name="acquireCredentialsCallback"/>` and `<paramref name="acquireResultCallback"/>` will be ignored by ` <see cref="GetCredentials(TargetUri)"/>`.
        /// </param>
        /// <param name="acquireCredentialsCallback">(optional) delegate for acquiring credentials.</param>
        /// <param name="acquireResultCallback">Optional delegate for notification of acquisition results.</param>
        public BasicAuthentication(
            RuntimeContext context,
            ICredentialStore credentialStore,
            NtlmSupport ntlmSupport,
            AcquireCredentialsDelegate acquireCredentialsCallback,
            AcquireResultDelegate acquireResultCallback)
            : base(context)
        {
            if (credentialStore is null)
            {
                throw new ArgumentNullException(nameof(credentialStore));
            }

            _acquireCredentials = acquireCredentialsCallback;
            _acquireResult      = acquireResultCallback;
            _credentialStore    = credentialStore;
            _ntlmSupport        = ntlmSupport;
        }