Open slomo opened 8 years ago
@liqd/write-access-adhocracy-3 Please leave comments and so we can extend the sections as needed.
I don't feel well without CSRF protection. There are plenty of different possiblities for this attack and I don't know if we really consider everything.
Okay than but how does CSRF protection works on a RestAPI?
I only did a short research but the more secure solutions i found have "double" authentication. Normal cooky auth and a csrf token send with HTTP-header (stored in local storage or cooky)
I worked with the csrf-token solution in django (rest framework) and angular in the frontedn and it worked fine
cool
Okay thanks for the feedback, I added CSRF to the ticket.
added "handle session timout in the frontend (R10)"
You suggest use one endpoint for token and cooky based authentication. To simplify documentation/implementation if would prefere one dedicated endpoint for each authentication method.
Also the difference between email and login name login does not make much sense from the client point of view. The backend could support both without much effort.
Befor we refactor authentication we should think about using "standard" architectures like Oauth2 (revoke + access token), we need to deal with this anyway. Here is an example with Oauth2, JWT, cookies http://de.slideshare.net/robertjd/jwt-authentication-with-angularjs . Benefits for the SinglePageApplication use case:
Due to security concerns (#2299) we should consider switching our authentication scheme to cookies.
Requirements:
Steps:
Post
withContent-Type
other thanapplication/json
(R8)/api/logout
on the backend (R3)/api/session
on the backend (R2)/api/login_username
and/api/login_email
to set cookie (R1)same-site
andhttp-only
is setHost
header and location/
X-Forwarded-Proto
isHTTPS
orHost
header starts withhttps://
/api/login_username
and/api/login_email
to setcsfr-token
cookie (R8)Host
header and location/
AdhCredentialsService
(R1/R2/R4)/api/login_username
and `/api/login_emailCsfr-Token
header