basic auth

master
Bel LaPointe 2019-04-19 07:23:57 -06:00
parent 07502502ef
commit 850052c4a5
1 changed files with 6 additions and 1 deletions

View File

@ -24,7 +24,7 @@ type LagReader struct {
func main() {
var bodyRepeat int
var path, host, method, body, headers, brandID, issuer string
var path, host, method, body, headers, brandID, issuer, basicAuth string
var ca, cert, key, secret string
var needJWT, verbose, jsonPP bool
var timeout, lag time.Duration
@ -34,6 +34,7 @@ func main() {
flag.StringVar(&body, "body", "", "body for request")
flag.IntVar(&bodyRepeat, "bodyrepeat", 1, "repeat body for request")
flag.StringVar(&brandID, "brand", "testencresponse", "brandID for request JWT")
flag.StringVar(&basicAuth, "auth", "", "comma separated user,password for basic auth")
flag.StringVar(&headers, "headers", "", "headers as k=v,k=v for request")
flag.StringVar(&issuer, "issuer", "dataprocessing,responseengine,fieldset-definitions,qualtrics,objectstore,svs,monolith,ex,blixt,null,responseengine", "issuer for jwt")
flag.BoolVar(&needJWT, "jwt", true, "need jwt boolean")
@ -77,6 +78,10 @@ func main() {
if needJWT {
setJWT(req, brandID, issuer, secret)
}
if basicAuth != "" {
splits := strings.Split(basicAuth, ",")
req.SetBasicAuth(splits[0], splits[1])
}
if verbose {
fmt.Fprintf(os.Stderr, "%v\n", req)