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

AuthenticationMethodChooser 添加无参数构造函数 #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion src/log4stash/Authentication/AuthenticationMethodChooser.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using log4stash.ErrorHandling;

using RestSharp;
using RestSharp.Authenticators;

Expand All @@ -9,6 +10,10 @@ public class AuthenticationMethodChooser : IAuthenticationMethodChooser
private readonly IExternalEventWriter _eventWriter;
private IAuthenticator _innerMethod;

public AuthenticationMethodChooser()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would break the AWS authentication method.

I think a larger refactor may be necessary here, like

  1. Refactoring the Authenticate method to accept an EventWriter; or
  2. Refactoring the authentication method "chooser" types to act as factories to create the appropriate authenticator when ActivateOptions is called on the appender.

I think (1) is probably sufficient?

Copy link
Owner

@urielha urielha Dec 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! really appreciate :)

Do you think you can implement the first method?
And regarding AWS authentication - does it break it for sure? I think I want to verify this before pushing this commit.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll work on that this evening.

{
}

public AuthenticationMethodChooser(IExternalEventWriter eventWriter)
{
_eventWriter = eventWriter;
Expand Down Expand Up @@ -37,7 +42,7 @@ public void AddApiKey(ApiKeyAuthenticationMethod method)
AddFilter(method);
}

#endregion
#endregion Helpers for common authentication methods

public void Authenticate(IRestClient client, IRestRequest request)
{
Expand Down