Find file
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (20 sloc) 1.59 KB

Basic Auth Lift Module

Uses Basic Auth to control access to the whole of a Lift application based on the run mode. Useful, for example, when you want to restrict access to a site before launch or restrict access to a staging site.

Using this module

  1. Add the following repository to your SBT project file:

    For SBT 0.10:

    resolvers += "liftmodules repository" at ""

    For SBT 0.7:

    lazy val liftModulesRelease = "liftmodules repository" at ""
  2. Include this dependency:

     "net.liftmodules" %% "basic-auth" % (liftVersion+"-1.2")
  3. In your application's Boot.boot code:

  4. Finally, add the following properties to the properties files of the run mode you wish to be protected. For example, add the following to src/main/resources/production.default.props If you want all run modes to have authentication put them in default.props

     liftmodules.basic.title=Protected Site

If there are paths you wish to exclude from authentication use the liftmodules.basic.paths property. This is a comma separated list of paths. We only match on the first part of the context path, e.g liftmodules.basic.paths=moose will give unauthorized access to any URL with the context path starting with moose e.g. http://localhost:8080/moose/id/123