| "veyron/services/identity/revocation" |
| // Revoke is an http.Handler implementation that revokes a Veyron PrivateID. |
| RevocationManager *revocation.RevocationManager |
| // TODO(suharshs): Move this to the googleoauth handler to enable authorization on this. |
| func (h Revoke) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
| w.Header().Set("Content-Type", "application/json") |
| success = `{"success": "true"}` |
| failure = `{"success": "false"}` |
| // Get the caveat string from the request. |
| // TODO(suharshs): Send a multi part form value from the client to server and parse it here. |
| content, err := ioutil.ReadAll(r.Body) |
| fmt.Printf("Failed to parse request: %s", err) |
| decoded_caveatID, err := base64.URLEncoding.DecodeString(string(content)) |
| fmt.Printf("base64 decoding failed: %s", err) |
| caveatID := security.ThirdPartyCaveatID(string(decoded_caveatID)) |
| if err := h.RevocationManager.Revoke(caveatID); err != nil { |
| fmt.Printf("Revocation failed: %s", err) |