Marten should provide an easy way to fire up new projects with a basic authentication flow already set up. To do so:
A new official marten-auth shard should be introduced in order to provide the basic authentication logic
A new --with-auth option should be added to the new management command in order to generate new projects with a basic authentication mechanism
A new Authentication section should be added to the documentation
Marten Auth shard
The new marten-auth shard should provide the necessary logic allowing to authenticate users and validate associated passwords, while also supporting standard password reset flows. The shard should provide a very basic abstract User model, and it should be intended that this model is subclassed in projects wishing to enable authentication.
The responsibilities that are envisioned for this shard are listed below:
Providing an abstract User model that projects should inherit from in order to define their own user models
Providing the ability to sign up new users
Providing the ability to sign in existing users
Providing the ability to sign out already authenticated users
Providing the ability to reset user passwords
The rationale behind only providing an abstract User model is that that way, projects can really own their user models: they can easily add new fields to them and generate migrations if they need to, and they don't depend on a third-party app for such "core" models. Projects could even choose to stop using the marten-auth shard after a while if they need to adapt the authentication further, but at least the shard would provide a good (and convenient) starting point that projects needing authentication could rely on.
Integration in Marten
A new --with-auth option should be added to the new management command. When set, this option should result in the generated project to:
use the marten-auth shard
define basic handlers, schemas, and emails implementing the sign up / sign in / sign out / password reset flows
Implementation
[x] Define the new marten-auth shard
[x] Add support for the new --with-auth option
[x] Add an Authentication section to the documentation
Description
Marten should provide an easy way to fire up new projects with a basic authentication flow already set up. To do so:
marten-auth
shard should be introduced in order to provide the basic authentication logic--with-auth
option should be added to thenew
management command in order to generate new projects with a basic authentication mechanismAuthentication
section should be added to the documentationMarten Auth shard
The new
marten-auth
shard should provide the necessary logic allowing to authenticate users and validate associated passwords, while also supporting standard password reset flows. The shard should provide a very basic abstractUser
model, and it should be intended that this model is subclassed in projects wishing to enable authentication.The responsibilities that are envisioned for this shard are listed below:
User
model that projects should inherit from in order to define their own user modelsThe rationale behind only providing an abstract
User
model is that that way, projects can really own their user models: they can easily add new fields to them and generate migrations if they need to, and they don't depend on a third-party app for such "core" models. Projects could even choose to stop using themarten-auth
shard after a while if they need to adapt the authentication further, but at least the shard would provide a good (and convenient) starting point that projects needing authentication could rely on.Integration in Marten
A new
--with-auth
option should be added to thenew
management command. When set, this option should result in the generated project to:marten-auth
shardImplementation
marten-auth
shard--with-auth
optionAuthentication
section to the documentation