github.com/reds/docker@v1.11.2-rc1/pkg/authorization/api.go (about) 1 package authorization 2 3 const ( 4 // AuthZApiRequest is the url for daemon request authorization 5 AuthZApiRequest = "AuthZPlugin.AuthZReq" 6 7 // AuthZApiResponse is the url for daemon response authorization 8 AuthZApiResponse = "AuthZPlugin.AuthZRes" 9 10 // AuthZApiImplements is the name of the interface all AuthZ plugins implement 11 AuthZApiImplements = "authz" 12 ) 13 14 // Request holds data required for authZ plugins 15 type Request struct { 16 // User holds the user extracted by AuthN mechanism 17 User string `json:"User,omitempty"` 18 19 // UserAuthNMethod holds the mechanism used to extract user details (e.g., krb) 20 UserAuthNMethod string `json:"UserAuthNMethod,omitempty"` 21 22 // RequestMethod holds the HTTP method (GET/POST/PUT) 23 RequestMethod string `json:"RequestMethod,omitempty"` 24 25 // RequestUri holds the full HTTP uri (e.g., /v1.21/version) 26 RequestURI string `json:"RequestUri,omitempty"` 27 28 // RequestBody stores the raw request body sent to the docker daemon 29 RequestBody []byte `json:"RequestBody,omitempty"` 30 31 // RequestHeaders stores the raw request headers sent to the docker daemon 32 RequestHeaders map[string]string `json:"RequestHeaders,omitempty"` 33 34 // ResponseStatusCode stores the status code returned from docker daemon 35 ResponseStatusCode int `json:"ResponseStatusCode,omitempty"` 36 37 // ResponseBody stores the raw response body sent from docker daemon 38 ResponseBody []byte `json:"ResponseBody,omitempty"` 39 40 // ResponseHeaders stores the response headers sent to the docker daemon 41 ResponseHeaders map[string]string `json:"ResponseHeaders,omitempty"` 42 } 43 44 // Response represents authZ plugin response 45 type Response struct { 46 // Allow indicating whether the user is allowed or not 47 Allow bool `json:"Allow"` 48 49 // Msg stores the authorization message 50 Msg string `json:"Msg,omitempty"` 51 52 // Err stores a message in case there's an error 53 Err string `json:"Err,omitempty"` 54 }