Skip to content

Commit

Permalink
Add override option for IsAuthenticated for GarnetAclWithAadAuthentic…
Browse files Browse the repository at this point in the history
…ator to respect token validation. (#868)

* Override for AclWithAadAuthenticator added. Earlier it would only use IsAuthenticated from base class i.e. GarnetAclAuthenticator which would not abide by IsAuthenticated from aad authenticator which sets token validity.

* Fixing whitespace
  • Loading branch information
Xizt authored Dec 11, 2024
1 parent f9c893c commit 52c8769
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libs/server/Auth/GarnetACLAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public GarnetACLAuthenticator(AccessControlList accessControlList, ILogger logge
/// <summary>
/// Check if the user is authorized to execute commands.
/// </summary>
public bool IsAuthenticated => _user != null;
public virtual bool IsAuthenticated => _user != null;

/// <summary>
/// ACL authenticator is can use ACL.
Expand Down
8 changes: 8 additions & 0 deletions libs/server/Auth/GarnetAclWithAadAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,13 @@ protected override bool AuthenticateInternal(User user, ReadOnlySpan<byte> usern
}
return false;
}

public override bool IsAuthenticated
{
get
{
return this._garnetAuthenticator.IsAuthenticated && base.IsAuthenticated;
}
}
}
}

0 comments on commit 52c8769

Please sign in to comment.