syncbase/bridge/go: Populate the discharges in newFakeServerCall
The errors we get without this fix look like this:
rejected blessings: [{"dev.v.io:o:608941808256-43vtfndets79kf5hac8ieujto8837660.apps.googleusercontent.com:razvanm.test.00@gmail.com": gojni: caveat validation failed: gojni:missing discharge for third party caveat(id=Eywl6NfD81tMuG0pK8k0xmLl4RUgMASY6mgaMgGeO7w=)}]
Thanks to mattr for pointing out this fix and to ivanpi for
investigating the issue.
Change-Id: I7e29c1e657333579d1530cf05e010a2ee6bdde4a
diff --git a/services/syncbase/bridge/bridge.go b/services/syncbase/bridge/bridge.go
index d20f71c..58bded4 100644
--- a/services/syncbase/bridge/bridge.go
+++ b/services/syncbase/bridge/bridge.go
@@ -13,6 +13,7 @@
wire "v.io/v23/services/syncbase"
"v.io/v23/verror"
"v.io/v23/vtrace"
+ slib "v.io/x/ref/lib/security"
)
// Bridge object, representing an in-process Syncbase singleton.
@@ -125,14 +126,17 @@
// the same as the "local" (server, i.e. Syncbase module) blessing.
// TODO(sadovsky): Eliminate this hack.
blessings, _ := p.BlessingStore().Default()
+ discharges, _ := slib.PrepareDischarges(ctx, blessings, security.BlessingNames(p, blessings), method.Name, nil)
return &fakeServerCall{
sec: security.NewCall(&security.CallParams{
- Method: method.Name,
- MethodTags: method.Tags,
- Suffix: suffix,
- LocalPrincipal: p,
- LocalBlessings: blessings,
- RemoteBlessings: blessings,
+ Method: method.Name,
+ MethodTags: method.Tags,
+ Suffix: suffix,
+ LocalPrincipal: p,
+ LocalBlessings: blessings,
+ RemoteBlessings: blessings,
+ RemoteDischarges: discharges,
+ LocalDischarges: discharges,
}),
srv: srv,
suffix: suffix,