wspr: rename ServerContext/SecurityContext to ServerCall/SecurityCall
MultiPart: 1/2
Change-Id: I76d049975fed85b28a48566dba118057609666b8
diff --git a/services/wsprd/app/mock_jsServer_test.go b/services/wsprd/app/mock_jsServer_test.go
index 1d5595e..090bb19 100644
--- a/services/wsprd/app/mock_jsServer_test.go
+++ b/services/wsprd/app/mock_jsServer_test.go
@@ -154,35 +154,35 @@
return nil
}
- context := msg.Context
- if field, got, want := "Method", context.Method, lib.LowercaseFirstCharacter(m.method); got != want {
+ call := msg.Call
+ if field, got, want := "Method", call.Method, lib.LowercaseFirstCharacter(m.method); got != want {
m.controller.HandleAuthResponse(m.flowCount, internalErrJSON(fmt.Sprintf("unexpected value for %s: got %v, want %v", field, got, want)))
return nil
}
- if field, got, want := "Suffix", context.Suffix, "adder"; got != want {
+ if field, got, want := "Suffix", call.Suffix, "adder"; got != want {
m.controller.HandleAuthResponse(m.flowCount, internalErrJSON(fmt.Sprintf("unexpected value for %s: got %v, want %v", field, got, want)))
return nil
}
// We expect localBlessings and remoteBlessings to be set and the publicKey be a string
- if !validateBlessing(context.LocalBlessings) {
- m.controller.HandleAuthResponse(m.flowCount, internalErrJSON(fmt.Sprintf("bad localblessing:%v", context.LocalBlessings)))
+ if !validateBlessing(call.LocalBlessings) {
+ m.controller.HandleAuthResponse(m.flowCount, internalErrJSON(fmt.Sprintf("bad localblessing:%v", call.LocalBlessings)))
return nil
}
- if !validateBlessing(context.RemoteBlessings) {
- m.controller.HandleAuthResponse(m.flowCount, internalErrJSON(fmt.Sprintf("bad remoteblessing:%v", context.RemoteBlessings)))
+ if !validateBlessing(call.RemoteBlessings) {
+ m.controller.HandleAuthResponse(m.flowCount, internalErrJSON(fmt.Sprintf("bad remoteblessing:%v", call.RemoteBlessings)))
return nil
}
// We expect endpoints to be set
- if !validateEndpoint(context.LocalEndpoint) {
- m.controller.HandleAuthResponse(m.flowCount, internalErrJSON(fmt.Sprintf("bad endpoint:%v", context.LocalEndpoint)))
+ if !validateEndpoint(call.LocalEndpoint) {
+ m.controller.HandleAuthResponse(m.flowCount, internalErrJSON(fmt.Sprintf("bad endpoint:%v", call.LocalEndpoint)))
return nil
}
- if !validateEndpoint(context.RemoteEndpoint) {
- m.controller.HandleAuthResponse(m.flowCount, internalErrJSON(fmt.Sprintf("bad endpoint:%v", context.RemoteEndpoint)))
+ if !validateEndpoint(call.RemoteEndpoint) {
+ m.controller.HandleAuthResponse(m.flowCount, internalErrJSON(fmt.Sprintf("bad endpoint:%v", call.RemoteEndpoint)))
return nil
}
@@ -229,14 +229,14 @@
return nil
}
- context := msg.Context.SecurityContext
- if field, got, want := "Suffix", context.Suffix, "adder"; got != want {
+ call := msg.Call.SecurityCall
+ if field, got, want := "Suffix", call.Suffix, "adder"; got != want {
m.controller.HandleServerResponse(m.flowCount, internalErrJSON(fmt.Sprintf("unexpected value for %s: got %v, want %v", field, got, want)))
return nil
}
- if !validateBlessing(context.RemoteBlessings) {
- m.controller.HandleServerResponse(m.flowCount, internalErrJSON(fmt.Sprintf("bad Remoteblessing:%v", context.RemoteBlessings)))
+ if !validateBlessing(call.RemoteBlessings) {
+ m.controller.HandleServerResponse(m.flowCount, internalErrJSON(fmt.Sprintf("bad Remoteblessing:%v", call.RemoteBlessings)))
return nil
}
diff --git a/services/wsprd/ipc/server/server.go b/services/wsprd/ipc/server/server.go
index 200a2ae..83d75ed 100644
--- a/services/wsprd/ipc/server/server.go
+++ b/services/wsprd/ipc/server/server.go
@@ -34,12 +34,12 @@
Handle int32
Method string
Args []interface{}
- Context ServerRPCRequestContext
+ Call ServerRPCRequestCall
}
-type ServerRPCRequestContext struct {
- SecurityContext SecurityContext
- Deadline vdltime.Deadline
+type ServerRPCRequestCall struct {
+ SecurityCall SecurityCall
+ Deadline vdltime.Deadline
}
type FlowHandler interface {
@@ -67,9 +67,9 @@
// AuthRequest is a request for a javascript authorizer to run
// This is exported to make the app test easier.
type AuthRequest struct {
- ServerID uint32 `json:"serverID"`
- Handle int32 `json:"handle"`
- Context SecurityContext `json:"context"`
+ ServerID uint32 `json:"serverID"`
+ Handle int32 `json:"handle"`
+ Call SecurityCall `json:"call"`
}
type Server struct {
@@ -130,7 +130,7 @@
func (s *Server) createRemoteInvokerFunc(handle int32) remoteInvokeFunc {
return func(methodName string, args []interface{}, call ipc.StreamServerCall) <-chan *lib.ServerRPCReply {
- securityContext := s.convertSecurityContext(call, true)
+ securityCall := s.convertSecurityCall(call, true)
flow := s.helper.CreateNewFlow(s, call)
replyChan := make(chan *lib.ServerRPCReply, 1)
@@ -153,9 +153,9 @@
}
- context := ServerRPCRequestContext{
- SecurityContext: securityContext,
- Deadline: timeout,
+ rpcCall := ServerRPCRequestCall{
+ SecurityCall: securityCall,
+ Deadline: timeout,
}
// Send a invocation request to JavaScript
@@ -164,7 +164,7 @@
Handle: handle,
Method: lib.LowercaseFirstCharacter(methodName),
Args: args,
- Context: context,
+ Call: rpcCall,
}
vomMessage, err := lib.VomEncode(message)
if err != nil {
@@ -229,7 +229,7 @@
// Until the tests get fixed, we need to create a security context before creating the flow
// because creating the security context creates a flow and flow ids will be off.
// See https://github.com/veyron/release-issues/issues/1181
- securityContext := s.convertSecurityContext(call, true)
+ securityCall := s.convertSecurityCall(call, true)
globChan := make(chan naming.VDLGlobReply, 1)
flow := s.helper.CreateNewFlow(s, &globStream{
@@ -253,9 +253,9 @@
return nil, verror.Convert(verror.ErrInternal, call.Context(), err).(verror.E)
}
- context := ServerRPCRequestContext{
- SecurityContext: securityContext,
- Deadline: timeout,
+ rpcCall := ServerRPCRequestCall{
+ SecurityCall: securityCall,
+ Deadline: timeout,
}
// Send a invocation request to JavaScript
@@ -264,7 +264,7 @@
Handle: handle,
Method: "Glob__",
Args: []interface{}{pattern},
- Context: context,
+ Call: rpcCall,
}
vomMessage, err := lib.VomEncode(message)
if err != nil {
@@ -332,7 +332,7 @@
func (s *Server) wsprCaveatValidator(call security.Call, cavs [][]security.Caveat) []error {
flow := s.helper.CreateNewFlow(s, nil)
req := CaveatValidationRequest{
- Ctx: s.convertSecurityContext(call, false),
+ Call: s.convertSecurityCall(call, false),
Cavs: cavs,
}
@@ -372,7 +372,7 @@
}
}
-func (s *Server) convertSecurityContext(call security.Call, includeBlessingStrings bool) SecurityContext {
+func (s *Server) convertSecurityCall(call security.Call, includeBlessingStrings bool) SecurityCall {
// TODO(bprosnitz) Local/Remote Endpoint should always be non-nil, but isn't
// due to a TODO in vc/auth.go
var localEndpoint string
@@ -391,7 +391,7 @@
for i, mtag := range call.MethodTags() {
anymtags[i] = mtag
}
- secCtx := SecurityContext{
+ secCtx := SecurityCall{
Method: lib.LowercaseFirstCharacter(call.Method()),
Suffix: call.Suffix(),
MethodTags: anymtags,
@@ -413,7 +413,7 @@
return func(call security.Call) error {
// Until the tests get fixed, we need to create a security context before creating the flow
// because creating the security context creates a flow and flow ids will be off.
- securityContext := s.convertSecurityContext(call, true)
+ securityCall := s.convertSecurityCall(call, true)
flow := s.helper.CreateNewFlow(s, nil)
replyChan := make(chan error, 1)
@@ -423,7 +423,7 @@
message := AuthRequest{
ServerID: s.id,
Handle: handle,
- Context: securityContext,
+ Call: securityCall,
}
vlog.VI(0).Infof("Sending out auth request for %v, %v", flow.ID, message)
diff --git a/services/wsprd/ipc/server/server.vdl b/services/wsprd/ipc/server/server.vdl
index e94afd3..3872b16 100644
--- a/services/wsprd/ipc/server/server.vdl
+++ b/services/wsprd/ipc/server/server.vdl
@@ -5,7 +5,7 @@
"v.io/v23/security"
)
-type SecurityContext struct {
+type SecurityCall struct {
Method string
Suffix string
MethodTags []any
@@ -18,7 +18,7 @@
}
type CaveatValidationRequest struct {
- Ctx SecurityContext
+ Call SecurityCall
Cavs [][]security.Caveat
}
diff --git a/services/wsprd/ipc/server/server.vdl.go b/services/wsprd/ipc/server/server.vdl.go
index 58908d5..adb4dad 100644
--- a/services/wsprd/ipc/server/server.vdl.go
+++ b/services/wsprd/ipc/server/server.vdl.go
@@ -15,7 +15,7 @@
"v.io/x/ref/services/wsprd/principal"
)
-type SecurityContext struct {
+type SecurityCall struct {
Method string
Suffix string
MethodTags []*vdl.Value
@@ -27,13 +27,13 @@
RemoteEndpoint string
}
-func (SecurityContext) __VDLReflect(struct {
- Name string "v.io/x/ref/services/wsprd/ipc/server.SecurityContext"
+func (SecurityCall) __VDLReflect(struct {
+ Name string "v.io/x/ref/services/wsprd/ipc/server.SecurityCall"
}) {
}
type CaveatValidationRequest struct {
- Ctx SecurityContext
+ Call SecurityCall
Cavs [][]security.Caveat
}
@@ -52,7 +52,7 @@
}
func init() {
- vdl.Register((*SecurityContext)(nil))
+ vdl.Register((*SecurityCall)(nil))
vdl.Register((*CaveatValidationRequest)(nil))
vdl.Register((*CaveatValidationResponse)(nil))
}