You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "ptupitsyn (via GitHub)" <gi...@apache.org> on 2023/04/18 10:50:54 UTC

[GitHub] [ignite-3] ptupitsyn commented on a diff in pull request #1950: IGNITE-19100 .NET: Add basic authentication support

ptupitsyn commented on code in PR #1950:
URL: https://github.com/apache/ignite-3/pull/1950#discussion_r1169852466


##########
modules/platforms/dotnet/Apache.Ignite.Tests/BasicAuthenticatorTests.cs:
##########
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Tests;
+
+using System.Threading.Tasks;
+using NUnit.Framework;
+using Security;
+
+/// <summary>
+/// Tests for <see cref="BasicAuthenticator"/>.
+/// </summary>
+public class BasicAuthenticatorTests : IgniteTestsBase
+{
+    private const string EnableAuthnJob = "org.apache.ignite.internal.runner.app.PlatformTestNodeRunner$EnableAuthenticationJob";
+
+    private bool _authnEnabled;
+
+    [TearDown]
+    public async Task DisableAuthenticationAfterTest()
+    {
+        await EnableAuthn(false);
+
+        Assert.DoesNotThrowAsync(async () => await Client.Tables.GetTablesAsync());
+    }
+
+    [Test]
+    public async Task TestAuthnOnClientNoAuthnOnServer()
+    {
+        var cfg = new IgniteClientConfiguration(GetConfig())
+        {
+            Authenticator = new BasicAuthenticator
+            {
+                Username = "u",
+                Password = "p"
+            }
+        };

Review Comment:
   Because we pass incorrect credentials intentionally - to make sure that they are ignored when authentication is disabled on the server.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org