Skip to content

Commit

Permalink
Move auth to general availability (#744)
Browse files Browse the repository at this point in the history
* Remove all preview markers from the APIs surrounding auth managers

* Fix styling
  • Loading branch information
thelonelyvulpes committed Oct 25, 2023
1 parent 9d48d59 commit 7691480
Show file tree
Hide file tree
Showing 37 changed files with 78 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using System.Net;
using System.Threading.Tasks;
using FluentAssertions;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.IntegrationTests.Internals;
using Neo4j.Driver.Internal;
using Neo4j.Driver.Internal.Auth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// limitations under the License.

using System;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.IntegrationTests.Internals;
using Xunit;
using Xunit.Abstractions;
Expand Down
2 changes: 1 addition & 1 deletion Neo4j.Driver/Neo4j.Driver.Tests.Integration/Examples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using FluentAssertions;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.IntegrationTests.Internals;
using Xunit;
using Xunit.Abstractions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using System.Diagnostics;
using System.Linq;
using System.Threading;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;

namespace Neo4j.Driver.IntegrationTests.Internals;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

using System;
using Castle.Core.Internal;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;

namespace Neo4j.Driver.IntegrationTests.Internals;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// limitations under the License.

using System;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;

namespace Neo4j.Driver.IntegrationTests.Internals;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

using System;
using System.IO;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;

namespace Neo4j.Driver.IntegrationTests.Internals;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// limitations under the License.

using System;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;

namespace Neo4j.Driver.IntegrationTests.Internals;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

using System;
using System.Diagnostics;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.TestUtil;

namespace Neo4j.Driver.IntegrationTests.Internals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

using System;
using System.Linq;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Org.BouncyCastle.Pkcs;

namespace Neo4j.Driver.IntegrationTests.Internals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// limitations under the License.

using System;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.IntegrationTests.Internals;
using Neo4j.Driver.TestUtil;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
using System.Threading;
using System.Threading.Tasks;
using FluentAssertions;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.IntegrationTests.Extensions;
using Neo4j.Driver.IntegrationTests.Internals;
using Neo4j.Driver.Internal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.Internal;
using Neo4j.Driver.Internal.Auth;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

using System;
using System.Threading.Tasks;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.Internal;
using Neo4j.Driver.Internal.Auth;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Newtonsoft.Json;

namespace Neo4j.Driver.Tests.TestBackend;
Expand Down
2 changes: 1 addition & 1 deletion Neo4j.Driver/Neo4j.Driver.Tests/AsyncSessionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using System.Threading.Tasks;
using FluentAssertions;
using Moq;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.Internal;
using Neo4j.Driver.Internal.Connector;
using Neo4j.Driver.Internal.Logging;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using FluentAssertions;
using Moq;
using Moq.AutoMock;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.Internal.Auth;
using Neo4j.Driver.Internal.Services;
using Xunit;
Expand Down
2 changes: 1 addition & 1 deletion Neo4j.Driver/Neo4j.Driver.Tests/ConnectionPoolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
using Neo4j.Driver.Internal;
using Neo4j.Driver.Internal.Connector;
using Neo4j.Driver.Internal.Util;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.Tests.TestUtil;
using Xunit;
using Xunit.Abstractions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
using System.Threading.Tasks;
using FluentAssertions;
using Moq;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.Internal;
using Neo4j.Driver.Internal.Auth;
using Neo4j.Driver.Internal.Connector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
using Neo4j.Driver.Internal.IO;
using Neo4j.Driver.Internal.MessageHandling;
using Neo4j.Driver.Internal.Messaging;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Xunit;

namespace Neo4j.Driver.Tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
using System.Threading.Tasks;
using FluentAssertions;
using Moq;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.Internal;
using Neo4j.Driver.Internal.Connector;
using Neo4j.Driver.Internal.MessageHandling;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
using Neo4j.Driver.Internal;
using Neo4j.Driver.Internal.Auth;
using Neo4j.Driver.Internal.Connector;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Xunit;

namespace Neo4j.Driver.Tests.Connector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
using FluentAssertions;
using Moq;
using Neo4j.Driver.Internal.Auth;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.Tests;
using Neo4j.Driver.Tests.TestUtil;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using System.Threading.Tasks;
using FluentAssertions;
using Moq;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.Internal;
using Neo4j.Driver.Internal.Auth;
using Neo4j.Driver.Internal.Connector;
Expand Down
2 changes: 1 addition & 1 deletion Neo4j.Driver/Neo4j.Driver.Tests/TestDriverContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

using System;
using Neo4j.Driver.Internal;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;

namespace Neo4j.Driver.Tests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
using System;
using Neo4j.Driver.Internal.Services;

namespace Neo4j.Driver.Preview.Auth;
namespace Neo4j.Driver.Auth;

/// <summary>
/// Represents an auth token and its expiration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using Neo4j.Driver.Internal.Auth;
using Neo4j.Driver.Internal.Services;

namespace Neo4j.Driver.Preview.Auth;
namespace Neo4j.Driver.Auth;

/// <summary>
/// This class provides common implementations of <see cref="IAuthTokenManager"/> without needing to create a new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace Neo4j.Driver.Preview.Auth;
namespace Neo4j.Driver.Auth;

/// <summary>Common interface for components that can provide auth tokens.</summary>
public interface IAuthTokenManager
Expand Down
48 changes: 44 additions & 4 deletions Neo4j.Driver/Neo4j.Driver/GraphDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// limitations under the License.

using System;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.Internal;
using Neo4j.Driver.Internal.Routing;

Expand Down Expand Up @@ -146,7 +146,17 @@ public static IDriver Driver(Uri uri, IAuthToken authToken)
return Driver(uri, authToken, null);
}

internal static IDriver Driver(Uri uri, IAuthTokenManager authTokenManager)
/// <summary>Returns a driver for a Neo4j instance with default configuration settings.</summary>
/// <param name="uri">
/// The URI to the Neo4j instance. Should be in the form
/// <c>protocol://&lt;server location&gt;:&lt;port&gt;</c>. If <c>port</c> is not supplied the default of <c>7687</c> will
/// be used. The supported protocols in URI could either be <c>bolt</c> or <c>neo4j</c>. The protocol <c>bolt</c> should be
/// used when creating a driver connecting to the Neo4j instance directly. The protocol <c>neo4j</c> should be used when
/// creating a driver with built-in routing.
/// </param>
/// <param name="authTokenManager">The <see cref="IAuthTokenManager"/> to use for authentication.</param>
/// <returns>A new <see cref="IDriver"/> instance.</returns>
public static IDriver Driver(Uri uri, IAuthTokenManager authTokenManager)
{
return Driver(uri, authTokenManager, null);
}
Expand All @@ -171,7 +181,22 @@ public static IDriver Driver(string uri, IAuthToken authToken, Action<ConfigBuil
return Driver(new Uri(uri), authToken, action);
}

internal static IDriver Driver(string uri, IAuthTokenManager authTokenManager, Action<ConfigBuilder> action)
/// <summary>Returns a driver for a Neo4j instance with custom configuration.</summary>
/// <param name="uri">
/// The URI to the Neo4j instance. Should be in the form
/// <c>protocol://&lt;server location&gt;:&lt;port&gt;</c>. If <c>port</c> is not supplied the default of <c>7687</c> will
/// be used. The supported protocols in URI could either be <c>bolt</c> or <c>neo4j</c>. The protocol <c>bolt</c> should be
/// used when creating a driver connecting to the Neo4j instance directly. The protocol <c>neo4j</c> should be used when
/// creating a driver with built-in routing.
/// </param>
/// <param name="authTokenManager">The <see cref="IAuthTokenManager"/> to use for authentication.</param>
/// <param name="action">
/// Specifies how to build a driver configuration <see cref="Config"/>, using
/// <see cref="ConfigBuilder"/>. If set to <c>null</c>, then no modification will be carried out and the default driver
/// configurations <see cref="Config"/> will be used when creating the driver.
/// </param>
/// <returns>A new <see cref="IDriver"/> instance.</returns>
public static IDriver Driver(string uri, IAuthTokenManager authTokenManager, Action<ConfigBuilder> action)
{
return Driver(new Uri(uri), authTokenManager, action);
}
Expand All @@ -194,7 +219,22 @@ public static IDriver Driver(Uri uri, IAuthToken authToken, Action<ConfigBuilder
return Driver(uri, AuthTokenManagers.Static(authToken), action);
}

internal static IDriver Driver(Uri uri, IAuthTokenManager authTokenManager, Action<ConfigBuilder> action)
/// <summary>Returns a driver for a Neo4j instance with custom configuration.</summary>
/// <param name="uri">
/// The URI to the Neo4j instance. Should be in the form
/// <c>protocol://&lt;server location&gt;:&lt;port&gt;</c>. If <c>port</c> is not supplied the default of <c>7687</c> will
/// be used. The supported protocols in URI could either be <c>bolt</c> or <c>neo4j</c>. The protocol <c>bolt</c> should be
/// used when creating a driver connecting to the Neo4j instance directly. The protocol <c>neo4j</c> should be used when
/// creating a driver with built-in routing.
/// </param>
/// <param name="authTokenManager">The <see cref="IAuthTokenManager"/> to use for authentication.</param>
/// <param name="action">
/// Specifies how to build a driver configuration <see cref="Config"/>, using
/// <see cref="ConfigBuilder"/>. If set to <c>null</c>, then no modification will be carried out and the default driver
/// configurations <see cref="Config"/> will be used when creating the driver.
/// </param>
/// <returns>A new <see cref="IDriver"/> instance.</returns>
public static IDriver Driver(Uri uri, IAuthTokenManager authTokenManager, Action<ConfigBuilder> action)
{
uri = uri ?? throw new ArgumentNullException(nameof(uri));
authTokenManager = authTokenManager ?? throw new ArgumentNullException(nameof(authTokenManager));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using System.Threading;
using System.Threading.Tasks;
using Neo4j.Driver.Internal.Services;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;

namespace Neo4j.Driver.Internal.Auth;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

using System.Threading;
using System.Threading.Tasks;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;

namespace Neo4j.Driver.Internal.Auth;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.Internal.MessageHandling;
using Neo4j.Driver.Internal.Messaging;
using Neo4j.Driver.Internal.Util;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.Internal.MessageHandling;
using Neo4j.Driver.Internal.Messaging;
using Neo4j.Driver.Internal.Util;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;
using Neo4j.Driver.Internal.Logging;
using Neo4j.Driver.Internal.MessageHandling;
using Neo4j.Driver.Internal.Messaging;
Expand Down
2 changes: 1 addition & 1 deletion Neo4j.Driver/Neo4j.Driver/Internal/DriverContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using System.Collections.Generic;
using Neo4j.Driver.Internal.Connector;
using Neo4j.Driver.Internal.Metrics;
using Neo4j.Driver.Preview.Auth;
using Neo4j.Driver.Auth;

namespace Neo4j.Driver.Internal;

Expand Down

0 comments on commit 7691480

Please sign in to comment.