-
Notifications
You must be signed in to change notification settings - Fork 82
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
Exposing TLS Configuration via Connection #84
Conversation
azuredevops/client.go
Outdated
suppressFedAuthRedirect: connection.SuppressFedAuthRedirect, | ||
forceMsaPassThrough: connection.ForceMsaPassThrough, | ||
userAgent: connection.UserAgent, | ||
BaseUrl: baseUrl, |
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.
Can you share how you plan to use each of these properties? Once they are set on the connection they are not supposed to be changed. Clients are cached on the connection, so the properties need to match. Resource locations are cached on the client, so changing the base url would invalidate it.
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.
client := &http.Client{Transport: tr}
if connection.Timeout != nil {
client.Timeout = *connection.Timeout
}
c := &azuredevops.Client{
baseUrl: connection.BaseUrl,
client: client,
authorization: connection.AuthorizationString,
suppressFedAuthRedirect: connection.SuppressFedAuthRedirect,
forceMsaPassThrough: connection.ForceMsaPassThrough,
userAgent: connection.UserAgent,
}
currently this is not feasible. as these are not exposed variables.
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.
I agree to the point changing properties is not the way intended. Creating Client with own configurable options should be exposed.
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 intention is to create a new connection if you want to change these. Most apps should never need more than one connection unless you are trying to connect to multiple organizations or trying to sign in with multiple identities.
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.
Agree. Current issue is, http client is internally created, this limits the customisation of standard http client creation (specially TLS Client).
As mentioned two approaches, we can add NewTLSClient(c Connection, baseUrl string, tls tls.Config)
or the above approach. I am kinda favouring the NewTLSClient the more I think about it. What's your suggestion!
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.
Can we create a new constructor for the Connection to take a delegate that will be used to construct the client? This way we ensure a consistent http client is used for each http client created from the Connection.
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.
Can you please review the changes now?
Why?
Proposed Solution:
Alternative Solution: