If you select the Basic auth option when generating your codebase, the cmd/web/middleware.go file will include a basicAuth() middleware function.