/// <summary>
        /// Inserts the auth headers into the request based on the <see cref="SecurityHeader"/> implementation
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="clientOrRequest"></param>
        /// <param name="security"></param>
        /// <returns></returns>
        public static T WithAuth <T>(this T clientOrRequest, SecurityHeader security) where T : IHttpSettingsContainer
        {
            if (security == null)
            {
                throw new ArgumentNullException($"{nameof(SecurityHeader)} provided is null");
            }

            return(security.AddAuth(clientOrRequest));
        }
示例#2
0
        /// <summary>
        /// Adds the security header onto every request unless overwritten by a specific client call via the parameters.
        /// </summary>
        /// <param name="auth"></param>
        /// <returns></returns>
        public ClientConfiguration WithSecurity(SecurityHeader auth)
        {
            Func <IHttpSettingsContainer, IHttpSettingsContainer> func = (IHttpSettingsContainer request) =>
            {
                return(auth.AddAuth(request));
            };

            PredefinedFunctions.Add(func);

            return(this);
        }