refactor: rework hooks and self-service flow completion #349
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch focuses on refactoring how self-service flows terminate and
changes how hooks behave and when they are executed.
Before this patch, it was not clear whether hooks run before or
after an identity is persisted. This caused problems with multiple
writes on the HTTP ResponseWriter and other bugs.
This patch removes certain hooks from after login, registration, and profile flows.
Per default, these flows now respond with an appropriate payload (
redirect for browsers, JSON for API clients) and deprecate
the
redirect
hook. This patch includes documentation which explainshow these hooks work now.
Additionally, the documentation was updated. Especially the sections
about hooks have been refactored. The login and user registration docs
have been updated to reflect the latest changes as well.
Also, some other minor, cosmetic, changes to the documentation have been made.
Closes #348
See #347
See #179
Closes #51
Closes #50
Closes #31
BREAKING CHANGE: Please remove the
redirect
hook from both login,registration, and settings after configuration. Please remove
the
session
hook from your login after configuration. Hookshave moved down a level and are now configured at
selfservice.<login|registration|settings>.<after|before>.hooks
instead of
selfservice.<login|registration|settings>.<after|before>.hooks
.Hooks are now identified by
hook:
instead ofjob:
. Pleaserename those sections accordingly.