Fix invalid account acl generating 500 response.

Sending an account POST with an X-Account-Access-Control
header value that is valid json but not a valid ACL was
causing a 500 Internal Error if the value did not parse
to a dict due to an exception being raised in tempauth.py.

This patch modifies acl.py to check that the header value
is both json and parses to a dict. The existing
tests are extended to cover these invalid header values.

This patch also enables json encoded dicts with whitespace
(e.g. '{ }') to be accepted as a value for
X-Account-Access-Control in the same way that '{}' is.
These previously resulted in a 400 response.

Closes-bug: 1281626

Change-Id: Ia06ba9c9d16f749f801a8158e73d3898c4a42888
Merge "Fix invalid account acl generating 500 response."