diff --git a/service.go b/service.go index af491f86..a693aa34 100644 --- a/service.go +++ b/service.go @@ -46,7 +46,7 @@ func newService(opts ...Option) Service { options.Server.Init( server.WrapHandler(wrapper.HandlerStats(stats.DefaultStats)), server.WrapHandler(wrapper.TraceHandler(trace.DefaultTracer)), - server.WrapHandler(wrapper.AuthHandler(authFn, serviceName)), + server.WrapHandler(wrapper.AuthHandler(authFn)), ) // set opts diff --git a/util/kubernetes/client/types.go b/util/kubernetes/client/types.go index deca24a0..0c6ecc29 100644 --- a/util/kubernetes/client/types.go +++ b/util/kubernetes/client/types.go @@ -40,9 +40,9 @@ type DeploymentSpec struct { // DeploymentCondition describes the state of deployment type DeploymentCondition struct { LastUpdate string `json:lastUpdateTime` - Type string `json:"type"` - reason string `json:"reason,omitempty"` - message string `json:"message,omitempty"` + Type string `json:"type"` + reason string `json:"reason,omitempty"` + message string `json:"message,omitempty"` } // DeploymentStatus is returned when querying deployment diff --git a/util/wrapper/wrapper.go b/util/wrapper/wrapper.go index 99897178..d28155c1 100644 --- a/util/wrapper/wrapper.go +++ b/util/wrapper/wrapper.go @@ -152,7 +152,7 @@ func TraceHandler(t trace.Tracer) server.HandlerWrapper { } // AuthHandler wraps a server handler to perform auth -func AuthHandler(fn func() auth.Auth, srvName string) server.HandlerWrapper { +func AuthHandler(fn func() auth.Auth) server.HandlerWrapper { return func(h server.HandlerFunc) server.HandlerFunc { return func(ctx context.Context, req server.Request, rsp interface{}) error { // get the auth.Auth interface @@ -187,11 +187,11 @@ func AuthHandler(fn func() auth.Auth, srvName string) server.HandlerWrapper { } // Verify the caller has access to the resource - err = a.Verify(account, &auth.Resource{Type: "service", Name: srvName, Endpoint: req.Endpoint()}) + err = a.Verify(account, &auth.Resource{Type: "service", Name: req.Service(), Endpoint: req.Endpoint()}) if err != nil && len(account.ID) > 0 { - return errors.Forbidden("go.micro.auth", "Forbidden call made to %v:%v by %v", srvName, req.Endpoint(), account.ID) + return errors.Forbidden("go.micro.auth", "Forbidden call made to %v:%v by %v", req.Service(), req.Endpoint(), account.ID) } else if err != nil { - return errors.Unauthorized("go.micro.auth", "Unauthorised call made to %v:%v", srvName, req.Endpoint()) + return errors.Unauthorized("go.micro.auth", "Unauthorised call made to %v:%v", req.Service(), req.Endpoint()) } // There is an account, set it in the context