basic auth
parent
07502502ef
commit
850052c4a5
7
main.go
7
main.go
|
|
@ -24,7 +24,7 @@ type LagReader struct {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var bodyRepeat int
|
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 ca, cert, key, secret string
|
||||||
var needJWT, verbose, jsonPP bool
|
var needJWT, verbose, jsonPP bool
|
||||||
var timeout, lag time.Duration
|
var timeout, lag time.Duration
|
||||||
|
|
@ -34,6 +34,7 @@ func main() {
|
||||||
flag.StringVar(&body, "body", "", "body for request")
|
flag.StringVar(&body, "body", "", "body for request")
|
||||||
flag.IntVar(&bodyRepeat, "bodyrepeat", 1, "repeat body for request")
|
flag.IntVar(&bodyRepeat, "bodyrepeat", 1, "repeat body for request")
|
||||||
flag.StringVar(&brandID, "brand", "testencresponse", "brandID for request JWT")
|
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(&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.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")
|
flag.BoolVar(&needJWT, "jwt", true, "need jwt boolean")
|
||||||
|
|
@ -77,6 +78,10 @@ func main() {
|
||||||
if needJWT {
|
if needJWT {
|
||||||
setJWT(req, brandID, issuer, secret)
|
setJWT(req, brandID, issuer, secret)
|
||||||
}
|
}
|
||||||
|
if basicAuth != "" {
|
||||||
|
splits := strings.Split(basicAuth, ",")
|
||||||
|
req.SetBasicAuth(splits[0], splits[1])
|
||||||
|
}
|
||||||
|
|
||||||
if verbose {
|
if verbose {
|
||||||
fmt.Fprintf(os.Stderr, "%v\n", req)
|
fmt.Fprintf(os.Stderr, "%v\n", req)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue