ws: Separate function for parsing auth input in CockpitAuth

This allows us to test the real parsing functionality in our
test-auth tests.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
common: Check that JSON is UTF8 before parsing it

Recent versions of json-glib do this (0.99.2 and later) but we need this
guarantee on earlier versions as well. Do the check on our own in
those cases. And define the JSON_PARSER_ERROR_INVALID_DATA error code
when it is not around.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
ws: Handle cases where login is not UTF8 valid

Produce an intelligent error message in these cases. cockpit-session
would have produced invalid JSON output here, and so we catch and
handle in properly.

Fixes #507
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>