services/proxy: Restore authorization checks at the proxy.
Closes vanadium/issues#33
Opens vanadium/issues#392
The fix for vanadium/issues#33 was crippled in commit
4897f5d039d24a543e7d9719c9a6e428c355d101 due to flakiness in the
javascript-browser integration tests. This commit restores the
functionality needed to close vanadium/issues#33 with a hack to work
around the JavaScript integration test flakiness.
My theory around the resulting flakiness is that the JavaScript browser
integration tests do not have a way of knowing when the server's
connection to the proxy is ready, and the additional time taken to fetch
discharges (for the blessings presented to the proxy) could be longer
than the time the tests waited for the server to be ready behind the
proxy.
Assuming that theory is correct, this hacky workaround makes
rpc.Server.Listen blocking till the discharges are fetched. The
JavaScript browser integration tests use `identityd` which in-turn
issues discharges that are valid for 15 minutes, so this prefetch in
Listen works our just fine for the tests (the call to PrepareDischarges
in proxyAuth.Login in profiles/internal/rpc/server.go is able to re-use
those cached discharges).
The efficacy of the workaround is empirically "proven" by the stability
in the presubmit tests for this change.
A more appropriate solution would involve avoiding "timed waits" in the
integration tests, but instead have them explicitly wait for the proxy
connection to be established. That is discussed in vanadium/issues#392.
Change-Id: I9902a194b9e9039f6657311bd464014270e3094f
2 files changed