@@ -109,12 +109,6 @@ func main() {
109109 return
110110 }
111111
112- if conf .User != "" && conf .Password != "" {
113- //lint:ignore SA1019 SetBasicAuth is marked as deprecated but we can't use
114- // BasicAuthTransport with custom TLS settings, like client certs.
115- client .Authentication .SetBasicAuth (conf .User , string (conf .Password ))
116- }
117-
118112 if retry , err := notify .NewReceiver (logger , conf , tmpl , client .Issue ).Notify (& data ); err != nil {
119113 var status int
120114 if retry {
@@ -191,7 +185,19 @@ func setupLogger(lvl string, fmt string) (logger log.Logger) {
191185 return
192186}
193187
188+ // createHTTPClient returns a jira.BasicAuthTransport or http Client, depending
189+ // on CAFile/client certificate options
194190func createHTTPClient (conf * config.ReceiverConfig ) (* http.Client , error ) {
191+
192+ // if CAFile, CertFile or KeyFile aren't specified, return BasicAuthTransport client
193+ if len (conf .CAFile ) == 0 && len (conf .CertFile ) == 0 && len (conf .KeyFile ) == 0 {
194+ tp := jira.BasicAuthTransport {
195+ Username : conf .User ,
196+ Password : string (conf .Password ),
197+ }
198+ return tp .Client (), nil
199+ }
200+
195201 tlsConfig , err := newTLSConfig (conf )
196202 if err != nil {
197203 return nil , err
@@ -204,7 +210,6 @@ func createHTTPClient(conf *config.ReceiverConfig) (*http.Client, error) {
204210 }
205211
206212 return hc , nil
207-
208213}
209214
210215func newTLSConfig (conf * config.ReceiverConfig ) (* tls.Config , error ) {
0 commit comments