Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added custom authentication support to Garnet. #648

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion libs/host/GarnetServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Garnet.common;
using Garnet.networking;
using Garnet.server;
using Garnet.server.Auth.Settings;
using Microsoft.Extensions.Logging;
using Tsavorite.core;

Expand Down Expand Up @@ -76,7 +77,9 @@ public class GarnetServer : IDisposable
/// </summary>
/// <param name="commandLineArgs">Command line arguments</param>
/// <param name="loggerFactory">Logger factory</param>
public GarnetServer(string[] commandLineArgs, ILoggerFactory loggerFactory = null, bool cleanupDir = false)
/// <param name="cleanupDir">Clean up directory.</param>
/// <param name="authenticationSettingsOverride">Override for custom authentication settings.</param>
public GarnetServer(string[] commandLineArgs, ILoggerFactory loggerFactory = null, bool cleanupDir = false, IAuthenticationSettings authenticationSettingsOverride = null)
{
Trace.Listeners.Add(new ConsoleTraceListener());

Expand Down Expand Up @@ -125,6 +128,7 @@ public GarnetServer(string[] commandLineArgs, ILoggerFactory loggerFactory = nul

// Assign values to GarnetServerOptions
this.opts = serverSettings.GetServerOptions(this.loggerFactory.CreateLogger("Options"));
this.opts.AuthSettings = authenticationSettingsOverride ?? this.opts.AuthSettings;
this.cleanupDir = cleanupDir;
this.InitializeServer();
}
Expand Down
2 changes: 1 addition & 1 deletion libs/server/Auth/GarnetACLAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Garnet.server.Auth
{
abstract class GarnetACLAuthenticator : IGarnetAuthenticator
public abstract class GarnetACLAuthenticator : IGarnetAuthenticator
{
/// <summary>
/// The Access Control List to authenticate users against
Expand Down