Skip to content

Commit

Permalink
Authenticate with nil body in v4 (#6)
Browse files Browse the repository at this point in the history
* make sure body is nil in v4 request

* changelog and version bump
  • Loading branch information
John Tuttle authored and dustinmm80 committed Jul 27, 2018
1 parent 14b4080 commit 4542007
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.11.1

- Fixed bug with request body during v4 authentication.

# 0.11.0

- Added support for Conjur v5.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.0
0.11.1
15 changes: 9 additions & 6 deletions requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ func AuthenticateRequest(authnURL string, conjurVersion string, account string,
authenticateURL = fmt.Sprintf("%s/%s/%s/authenticate", authnURL, account, url.QueryEscape(username))
}

var body *bytes.Reader

infoLogger.Printf("making authn request to %s", authenticateURL)

var req *http.Request
var err error

if conjurVersion == "5" {
body = bytes.NewReader(cert)
body := bytes.NewReader(cert)
req, err = http.NewRequest("POST", authenticateURL, body)
} else {
req, err = http.NewRequest("POST", authenticateURL, nil)
}

infoLogger.Printf("making authn request to %s", authenticateURL)

req, err := http.NewRequest("POST", authenticateURL, body)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 4542007

Please sign in to comment.