-
Notifications
You must be signed in to change notification settings - Fork 36
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
feat: when using a credential script, re-auth on 401s #2203
Conversation
@@ -179,14 +188,9 @@ func (c *Credentials) GetPollerAuth() (PollerAuth, error) { | |||
defaultAuth.Username = auth.Username | |||
} | |||
c.poller.Username = defaultAuth.Username | |||
c.poller.Password = defaultAuth.Password |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this line removed?
@@ -154,7 +164,6 @@ func (c *Credentials) GetPollerAuth() (PollerAuth, error) { | |||
} | |||
if auth.Password != "" { | |||
c.poller.Username = auth.Username | |||
c.poller.Password = auth.Password |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this line removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It the value is written back to a poller's password, it's indistinguishable from the harvest.yml
containing a poller with that password, which will break the precedent rules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code flow appears to be confusing because the method in question returns a value called defaultAuth, which includes the username. However, within the same method, the username is also being set in the poller. Therefore, it seems that the username is being consumed in two different ways.
Fixes: #2168