Пример #1
0
        public Authentication(UserCredentialsParameters parameters)
        {
            ArgsCheck.IsNotNull(parameters);

            InfiniteToken       = null;
            Parameters          = parameters;
            ProxySettings       = parameters.ProxySettings;
            GlobalConfiguration = UtilsGlobalConfiguration.GetConfiguration();
        }
Пример #2
0
        public Authentication(TokenServiceParameters parameters)
        {
            ArgsCheck.IsNotNull(parameters);
            ArgsCheck.IsNotNullOrEmptyOrWhiteSpace(nameof(parameters.Token), parameters.Token);

            InfiniteToken       = parameters.Token;
            GlobalConfiguration = UtilsGlobalConfiguration.GetConfiguration();
            ProxySettings       = parameters.ProxySettings;
        }
Пример #3
0
        internal Authentication(UserCredentialsParameters parameters, GlobalConfiguration configuration)
        {
            ArgsCheck.IsNotNull(parameters);
            ArgsCheck.IsNotNull(configuration);

            InfiniteToken       = null;
            Parameters          = parameters;
            ProxySettings       = parameters.ProxySettings;
            GlobalConfiguration = configuration;
        }
Пример #4
0
        internal Authentication(TokenServiceParameters parameters, GlobalConfiguration configuration)
        {
            ArgsCheck.IsNotNull(parameters);
            ArgsCheck.IsNotNullOrEmptyOrWhiteSpace(nameof(parameters.Token), parameters.Token);
            ArgsCheck.IsNotNull(configuration);

            InfiniteToken       = parameters.Token;
            GlobalConfiguration = configuration;
            ProxySettings       = parameters.ProxySettings;
        }
        public static HttpClient AddAuthenticationHeaders(this HttpClient client, UserCredentialsParameters parameters)
        {
            ArgsCheck.IsNotNull(nameof(client), client);
            ArgsCheck.IsNotNull(nameof(parameters), parameters);

            var headers = parameters.ToAuthenticationHeaders();

            foreach (var key in headers.Keys)
            {
                client.DefaultRequestHeaders.Add(key, headers[key]);
            }

            return(client);
        }
Пример #6
0
        private Response <AuthenticationData> PresentPostResponse(Task <HttpResponseMessage> response)
        {
            ArgsCheck.IsNotNull(nameof(response), response);

            if (response.IsFaulted)
            {
            }

            if (response.IsCanceled)
            {
            }

            var data = new AuthenticationData();

            return(new Response <AuthenticationData>());
        }
Пример #7
0
        private T HandleInnerExceptions <T>(Func <T> func)
        {
            ArgsCheck.IsNotNull(nameof(func), func);

            try
            {
                return(func.Invoke());
            }
            catch (FaultException <FaultResponse> )
            {
                throw;
            }
            catch (HttpRequestException ex)
            {
                ExceptionHandler.HandleError(ex, ErrorHandlePolicy.Authentication);
                throw;
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleError(ex, ErrorHandlePolicy.Authentication);
                throw;
            }
        }
Пример #8
0
 public Response(T data)
 {
     ArgsCheck.IsNotNull(nameof(data), data);
     Data = data;
 }
Пример #9
0
 public static void AssertIsNotNullOrEmptyOrWhiteSpace(this string arg)
 {
     ArgsCheck.IsNotNullOrEmptyOrWhiteSpace(nameof(arg), arg);
     //$ $END$
 }
Пример #10
0
 public static void AssertDetailIsNotNull <T>(this FaultException <T> arg)
 {
     ArgsCheck.DetailIsNotNull(arg);
     //$ $END$
 }
Пример #11
0
 public static void AssertIsNotNull(this object arg)
 {
     ArgsCheck.IsNotNull(nameof(arg), arg);
     //$ $END$
 }