I am working on an authorization plugin in Go and I am stuck with it. When I send commands to the Docker Engine on localhost, I get the RequestURI and RequestBody well but not the User who sent the request. It's an empty string.
func (e AuthzEntity) AuthZReq(req authorization.Request) authorization.Response {
log.Println("RequestURI: ", req.RequestURI, " RequestBody: ", string(req.RequestBody))
if "USER" == req.User {
log.Println("Authorized")
} else {
log.Println("Unauthorized")
}
return authorization.Response{true, "", ""}
}
With the above code I expect the text "Authorized" in the logs, but I see "Unauthorized" and the Username is empty.
Can someone help me?