Exemplo n.º 1
0
        public Authentication(UserCredentialsParameters parameters)
        {
            ArgsCheck.IsNotNull(parameters);

            InfiniteToken       = null;
            Parameters          = parameters;
            ProxySettings       = parameters.ProxySettings;
            GlobalConfiguration = UtilsGlobalConfiguration.GetConfiguration();
        }
Exemplo n.º 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;
        }
Exemplo n.º 3
0
        internal Authentication(UserCredentialsParameters parameters, GlobalConfiguration configuration)
        {
            ArgsCheck.IsNotNull(parameters);
            ArgsCheck.IsNotNull(configuration);

            InfiniteToken       = null;
            Parameters          = parameters;
            ProxySettings       = parameters.ProxySettings;
            GlobalConfiguration = configuration;
        }
Exemplo n.º 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);
        }
Exemplo n.º 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>());
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 8
0
 public Response(T data)
 {
     ArgsCheck.IsNotNull(nameof(data), data);
     Data = data;
 }
Exemplo n.º 9
0
 public static void AssertIsNotNull(this object arg)
 {
     ArgsCheck.IsNotNull(nameof(arg), arg);
     //$ $END$
 }