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

[FEATURE] Enable basic auth per site variant #7

Open
AureliusHogan opened this issue Oct 27, 2021 · 2 comments
Open

[FEATURE] Enable basic auth per site variant #7

AureliusHogan opened this issue Oct 27, 2021 · 2 comments

Comments

@AureliusHogan
Copy link

Is there any possibility to enable the module only for a sublist of applicationContext's inside an site configuration?

/Production/Test/www
/Production/Live/www
/Development/Test/www
/Development/Live/www
/Development/Test/com

They all point to the same site configuration. But I would like to activate your extension only if applicationContext is /Test/.

Is that possible somehow?

@christophlehmann
Copy link
Owner

Not at the moment, but it should be easy to integrate it:

  • Add field basicauth_enabled in a site_base_variant.php (Overrides/-Folder)
  • Handle it in Classes/Middleware/BasicAuth.php

Would you give it a try?

@christophlehmann christophlehmann changed the title Configuration [FEATURE] Enable basic auth per site variant Oct 27, 2021
@a-r-m-i-n
Copy link

A more elegant approach is to register an own Middleware before yours.

In this middleware you take the site from request, take and edit the site options to your needs (eg. Application Context based) and create a new site instance, which get assigned the to request attribute "site".

Tested it and worked like charm.

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

No branches or pull requests

3 participants