code: func (g *Generator) generateSecurity() (err error) {
  	if len(g.API.SecuritySchemes) == 0 {
  		return nil
  	}
  
  	var (
  		secFile string
  		secWr   *SecurityWriter
  	)
  	{
  		secFile = filepath.Join(g.OutDir, "security.go")
  		secWr, err = NewSecurityWriter(secFile)
  		if err != nil {
  			return
  		}
  	}
  	defer func() {
  		secWr.Close()
  		if err == nil {
  			err = secWr.FormatCode()
  		}
  	}()
  	title := fmt.Sprintf("%s: Application Security", g.API.Context())
  	imports := []*codegen.ImportSpec{
  		codegen.SimpleImport("net/http"),
  		codegen.SimpleImport("errors"),
  		codegen.SimpleImport("context"),
  		codegen.SimpleImport("github.com/goadesign/goa"),
  	}
  	if err = secWr.WriteHeader(title, g.Target, imports); err != nil {
  		return err
  	}
  	g.genfiles = append(g.genfiles, secFile)
  	err = secWr.Execute(design.Design.SecuritySchemes)
  
  	return
  }
docs: // generateControllers iterates through the API resources and generates the low level
  // controllers.