Remove service type role

This commit is contained in:
Ben Toogood 2020-05-13 13:42:56 +01:00
parent 25c937fd0e
commit 3fac7d79ab

View File

@ -233,21 +233,11 @@ func (s *service) Run() error {
} }
func (s *service) registerAuthAccount() error { func (s *service) registerAuthAccount() error {
// determine the type of service from the name. we do this so we can allocate
// different roles depending on the type of services. e.g. we don't want web
// services talking directly to the runtime. TODO: find a better way to determine
// the type of service
serviceType := "service"
if strings.Contains(s.Name(), "api") {
serviceType = "api"
} else if strings.Contains(s.Name(), "web") {
serviceType = "web"
}
// generate a new auth account for the service // generate a new auth account for the service
name := fmt.Sprintf("%v-%v", s.Name(), s.Server().Options().Id) name := fmt.Sprintf("%v-%v", s.Name(), s.Server().Options().Id)
opts := []auth.GenerateOption{ opts := []auth.GenerateOption{
auth.WithRoles(serviceType), auth.WithType("service"),
auth.WithRoles("service"),
auth.WithNamespace(s.Options().Auth.Options().Namespace), auth.WithNamespace(s.Options().Auth.Options().Namespace),
} }
acc, err := s.Options().Auth.Generate(name, opts...) acc, err := s.Options().Auth.Generate(name, opts...)