veyron2/ipc,veyron/runtimes/google/ipc: Make the blessings used to authenticate
the server accessible to the client in ipc.Call.
Change-Id: I50e5aede707ad6375cea245429ee2c056c9504c5
diff --git a/runtimes/google/ipc/client.go b/runtimes/google/ipc/client.go
index 358d78b..51f7706 100644
--- a/runtimes/google/ipc/client.go
+++ b/runtimes/google/ipc/client.go
@@ -536,3 +536,8 @@
vtrace.FromContext(fc.ctx).Annotate("Cancelled")
fc.flow.Cancel()
}
+
+func (fc *flowClient) RemoteBlessings() ([]string, security.Blessings) {
+ // TODO(ashankar): Fill in the second result once the switch to the new API is complete.
+ return fc.flow.RemoteID().Names(), nil
+}
diff --git a/runtimes/google/ipc/full_test.go b/runtimes/google/ipc/full_test.go
index 10e2baf..979c98c 100644
--- a/runtimes/google/ipc/full_test.go
+++ b/runtimes/google/ipc/full_test.go
@@ -412,8 +412,13 @@
stopServer(t, server, ns)
continue
}
- if _, err := client.StartCall(testContext(), "mountpoint/server/suffix", "irrelevant", nil, veyron2.RemoteID(test.pattern)); !matchesErrorPattern(err, test.err) {
+ if call, err := client.StartCall(testContext(), "mountpoint/server/suffix", "irrelevant", nil, veyron2.RemoteID(test.pattern)); !matchesErrorPattern(err, test.err) {
t.Errorf(`%s: client.StartCall: got error "%v", want to match "%v"`, name, err, test.err)
+ } else if call != nil {
+ serverBlessings, _ := call.RemoteBlessings()
+ if !reflect.DeepEqual(serverBlessings, serverID.PublicID().Names()) {
+ t.Errorf("%s: Server authenticated as %v, wanted %v", name, serverBlessings, serverID.PublicID().Names())
+ }
}
client.Close()
stopServer(t, server, ns)
diff --git a/runtimes/google/testing/mocks/ipc/simple_client.go b/runtimes/google/testing/mocks/ipc/simple_client.go
index a329a72..eb94e75 100644
--- a/runtimes/google/testing/mocks/ipc/simple_client.go
+++ b/runtimes/google/testing/mocks/ipc/simple_client.go
@@ -8,6 +8,7 @@
"veyron.io/veyron/veyron2/context"
"veyron.io/veyron/veyron2/ipc"
+ "veyron.io/veyron/veyron2/security"
"veyron.io/veyron/veyron2/vlog"
)
@@ -61,7 +62,7 @@
return &clientCall, nil
}
-// Close Implements ipc.Client
+// Close implements ipc.Client
func (*SimpleMockClient) Close() {
defer vlog.LogCall()()
}
@@ -98,6 +99,11 @@
return nil
}
+// RemoteBlessings implements ipc.Call
+func (*mockCall) RemoteBlessings() ([]string, security.Blessings) {
+ return []string{}, nil
+}
+
//mockStream implements ipc.Stream
type mockStream struct{}