How to set up project-wide password protection¶

.htaccess is a familiar way ofadding password protection to a web server at directory level.

Your Test server is always protected by our SSO, butyou may occasionally require other forms of site-wide password protection.

It can be useful in the development process, for example, when you need torestrict access, or for a site that provides API endpoints that should requirethe client to authenticate.

A similar site-wide password requirement can be added to a Divio Cloud site,using environment variables. Set them as follows:

  1. ALDRYN_SSO_ALWAYS_REQUIRE_LOGIN=basicauth
  2. ALDRYN_SSO_BASICAUTH_USER=<username>
  3. ALDRYN_SSO_BASICAUTH_PASSWORD=<password>

Those values can be set independently for test/live servers in the EnvironmentVariables settings for each project.

See ALDRYN_SSO_BASICAUTH_USER and ALDRYN_SSO_BASICAUTH_PASSWORD for more.

How this works¶

These variables are handled in the 3. Divio Cloud single-sign-on module.

You can see exactly what it does with them - and others - inhttps://github.com/aldryn/aldryn-sso/blob/master/aldryn_config.py

原文: http://docs.divio.com/en/latest/how-to/password-protect-project.html