Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add optional authentication for plugin routes #3400

Merged

Conversation

kontrollanten
Copy link
Contributor

@kontrollanten kontrollanten commented Dec 4, 2020

Description

  • When creating custom routes with plugins, let the plugin author check if the user is authenticated or not.
  • authenticate middleware now sets res.locals.authenticated to true upon successful authentication.

Related issues

Has this been tested?

  • 👍 yes, I added tests to the test suite
  • 👍 yes, light tests as follows are enough
  • 💭 no, because this PR is a draft and still needs work
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

Setting res.locals.authenticated explicity to
true makes it's more clear whether the req is
authenticated when using optionalAuthenticate
middlware.
@rigelk rigelk changed the title plugins: add optional authentication for routes add optional authentication for plugin routes Dec 7, 2020
@Chocobozzz
Copy link
Owner

Thanks @kontrollanten

@Chocobozzz Chocobozzz merged commit 2805cb7 into Chocobozzz:develop Dec 8, 2020
@kontrollanten kontrollanten deleted the plugins-add-optional-auth branch December 8, 2020 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants