Ghost/core/server/services/auth
Fabien O'Carroll a701ee7023
Added support for token session to /ghost (#11709)
no-issue

* Added default for getting origin of request

This function is used to attach the origin of the request to the
session, and later check that requests using the session are coming from
the same origin. This protects us against CSRF attacks as requests in
the browser MUST originate from the same origin on which the user
logged in.

Previously, when we could not determine the origin we would return
null, as a "safety" net.

This updates the function to use a secure and sensible default - which
is the origin of the Ghost-Admin application, and if that's not set -
the origin of the Ghost application.

This will make dealing with magic links simpler as you can not always
guaruntee the existence of these headers when visiting via a hyperlink

* Removed init fns and getters from session service

This simplifies the code here, making it easier to read and maintain

* Moved express-session initialisation to own file

This is complex enough that it deserves its own module

* Added createSessionFromToken to session service

* Wired up the createSessionFromToken middleware
2020-04-06 11:49:14 +02:00
..
api-key 🏗 Migrated scheduler to work with v2 API (#11142) 2019-09-23 21:42:53 +05:30
members Fixed invalid method usage in members authentication 2019-06-27 15:21:21 +05:30
session Added support for token session to /ghost (#11709) 2020-04-06 11:49:14 +02:00
authenticate.js 🏗 Migrated scheduler to work with v2 API (#11142) 2019-09-23 21:42:53 +05:30
authorize.js 🔥 Removed v0.1 auth services (#11104) 2019-09-11 19:40:48 +02:00
index.js 🔥 Removed v0.1 auth services (#11104) 2019-09-11 19:40:48 +02:00
passwordreset.js Refactored authentication controller v0.1 (#10893) 2019-07-17 12:28:16 +02:00
setup.js 🐛 Fixed blog setup crashing for falsy email config (#11041) 2019-08-20 15:43:43 +05:30