expressjs / generator

Express' application generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make authentication configurable with cli option

johncmunson opened this issue · comments

Currently, you get cookies no matter what.

We can all debate what should be the default, but I think it would be very convenient to have options here.

--auth=cookie
--auth=jwt
--auth=session
--auth=basic
--no-auth

Hi @johncmunson what you do you mean by you get cookies no matter what? There is no authentication system in this generator currently, so not sure what you mean by that.

As for adding one, you'll likely need to make a pull request if you're inclined to have the feature, as otherwise there is likely no one who will do so, and what exactly you would like those options to do are not spelled out enough here for someone else to even take up the task.

The generator gives you cookie-parser out of the box, which can be used for authentication purposes, but these days JWT's seem to be more commonly used. Some of these auth schemes would require pulling in third party libraries like Passport, but the setup is usually minimal.

I understand nobody but myself is going to tackle an issue like this.. I mainly just wanted to post the issue so I'm reminded of it when I get some free time.

I'm hesitant to get started on a PR though, considering that things like --es6 or --typescript have been discussed for ages, but still haven't landed.

Just because cookie parser is included doesn't restrict your available auth options. Cookies are used for many more things than just auth.

As to why they have not been merged, most do not even pass the CI, have comments that need addressed, like lack of tests, etc.

Closing as stale.

commented

please don't use passport, it makes life harder with all the callbacks,
if you ever add auth, make a custom implementation in "expressjs" style