IGNITE-8042: .NET: Thin client: authentication support - fix naming and 
inspections


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9be3357c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9be3357c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9be3357c

Branch: refs/heads/ignite-7708
Commit: 9be3357c427f7839ce347831517327a572c0c18d
Parents: 44c4656
Author: Pavel Tupitsyn <ptupit...@apache.org>
Authored: Fri Apr 13 12:44:17 2018 +0300
Committer: Pavel Tupitsyn <ptupit...@apache.org>
Committed: Fri Apr 13 12:44:17 2018 +0300

----------------------------------------------------------------------
 .../Client/ClientConnectionTest.cs                    | 12 ++++++------
 .../Client/IgniteClientConfiguration.cs               |  4 ++--
 .../IgniteClientConfigurationSection.xsd              |  2 +-
 .../Apache.Ignite.Core/Impl/Client/ClientSocket.cs    | 14 +++++++-------
 4 files changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/9be3357c/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
 
b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
index cb30f40..0a6b1a7 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Client/ClientConnectionTest.cs
@@ -98,11 +98,11 @@ namespace Apache.Ignite.Core.Tests.Client
 
                 cliCfg.Password = "ignite";
 
-                cliCfg.Username = null;
+                cliCfg.UserName = null;
                 ex = Assert.Throws<IgniteClientException>(() => { 
Ignition.StartClient(cliCfg); });
                 
Assert.IsTrue(ex.Message.StartsWith("IgniteClientConfiguration.Username cannot 
be null"));
 
-                cliCfg.Username = "";
+                cliCfg.UserName = "";
                 ex = Assert.Throws<IgniteClientException>(() => { 
Ignition.StartClient(cliCfg); });
                 
Assert.IsTrue(ex.Message.StartsWith("IgniteClientConfiguration.Username cannot 
be empty"));
             }
@@ -118,12 +118,12 @@ namespace Apache.Ignite.Core.Tests.Client
             {
                 var cliCfg = SecureClientConfig();
 
-                cliCfg.Username = "invalid";
+                cliCfg.UserName = "invalid";
 
                 var ex = Assert.Throws<IgniteClientException>(() => { 
Ignition.StartClient(cliCfg); });
                 Assert.True(ex.StatusCode == 
ClientStatusCode.AuthenticationFailed);
 
-                cliCfg.Username = "ignite";
+                cliCfg.UserName = "ignite";
                 cliCfg.Password = "invalid";
 
                 ex = Assert.Throws<IgniteClientException>(() => { 
Ignition.StartClient(cliCfg); });
@@ -165,7 +165,7 @@ namespace Apache.Ignite.Core.Tests.Client
 
                 var cliCfg = SecureClientConfig();
 
-                cliCfg.Username = "my_User";
+                cliCfg.UserName = "my_User";
                 cliCfg.Password = "my_Password";
 
                 using (var cli = Ignition.StartClient(cliCfg))
@@ -532,7 +532,7 @@ namespace Apache.Ignite.Core.Tests.Client
             return new IgniteClientConfiguration()
             {
                 Host = "localhost",
-                Username = "ignite",
+                UserName = "ignite",
                 Password = "ignite"
             };
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/9be3357c/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs
 
b/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs
index 3252495..80f26cf 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Core/Client/IgniteClientConfiguration.cs
@@ -91,7 +91,7 @@ namespace Apache.Ignite.Core.Client
             BinaryProcessor = cfg.BinaryProcessor;
             SslStreamFactory = cfg.SslStreamFactory;
 
-            Username = cfg.Username;
+            UserName = cfg.UserName;
             Password = cfg.Password;
         }
 
@@ -151,7 +151,7 @@ namespace Apache.Ignite.Core.Client
         /// <summary>
         /// Username to be used to connect to secured cluster.
         /// </summary>
-        public string Username { get; set; }
+        public string UserName { get; set; }
 
         /// <summary>
         /// Password to be used to connect to secured cluster.

http://git-wip-us.apache.org/repos/asf/ignite/blob/9be3357c/modules/platforms/dotnet/Apache.Ignite.Core/IgniteClientConfigurationSection.xsd
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteClientConfigurationSection.xsd
 
b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteClientConfigurationSection.xsd
index 7e6caff..b9a04b8 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteClientConfigurationSection.xsd
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteClientConfigurationSection.xsd
@@ -237,7 +237,7 @@
                     <xs:documentation>Socket operation timeout. Zero or 
negative for infinite timeout.</xs:documentation>
                 </xs:annotation>
             </xs:attribute>
-            <xs:attribute name="username" type="xs:string">
+            <xs:attribute name="userName" type="xs:string">
                 <xs:annotation>
                     <xs:documentation>Username to be used to connect to 
secured cluster.</xs:documentation>
                 </xs:annotation>

http://git-wip-us.apache.org/repos/asf/ignite/blob/9be3357c/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
----------------------------------------------------------------------
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs 
b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
index bce681f..11d7942 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Client/ClientSocket.cs
@@ -124,11 +124,11 @@ namespace Apache.Ignite.Core.Impl.Client
         /// Validate configuration.
         /// </summary>
         /// <param name="cfg">Configuration.</param>
-        private void Validate(IgniteClientConfiguration cfg)
+        private static void Validate(IgniteClientConfiguration cfg)
         {
-            if (cfg.Username != null)
+            if (cfg.UserName != null)
             {
-                if (cfg.Username.Length == 0)
+                if (cfg.UserName.Length == 0)
                     throw new 
IgniteClientException("IgniteClientConfiguration.Username cannot be empty.");
 
                 if (cfg.Password == null)
@@ -140,8 +140,8 @@ namespace Apache.Ignite.Core.Impl.Client
                 if (cfg.Password.Length == 0)
                     throw new 
IgniteClientException("IgniteClientConfiguration.Password cannot be empty.");
 
-                if (cfg.Username == null)
-                    throw new 
IgniteClientException("IgniteClientConfiguration.Username cannot be null when 
Password is set.");
+                if (cfg.UserName == null)
+                    throw new 
IgniteClientException("IgniteClientConfiguration.UserName cannot be null when 
Password is set.");
             }
         }
 
@@ -262,7 +262,7 @@ namespace Apache.Ignite.Core.Impl.Client
         /// </summary>
         private void Handshake(IgniteClientConfiguration clientConfiguration, 
ClientProtocolVersion version)
         {
-            bool auth = version.CompareTo(Ver110) >= 0 && 
clientConfiguration.Username != null;
+            bool auth = version.CompareTo(Ver110) >= 0 && 
clientConfiguration.UserName != null;
 
             // Send request.
             int messageLen;
@@ -284,7 +284,7 @@ namespace Apache.Ignite.Core.Impl.Client
                 {
                     var writer = BinaryUtils.Marshaller.StartMarshal(stream);
 
-                    writer.WriteString(clientConfiguration.Username);
+                    writer.WriteString(clientConfiguration.UserName);
                     writer.WriteString(clientConfiguration.Password);
 
                     BinaryUtils.Marshaller.FinishMarshal(writer);

Reply via email to