Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
project
src/main/scala/net/liftmodules/lib
.gitignore
LICENSE.txt
README.md
build.sbt

README.md

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 "http://repository-liftmodules.forge.cloudbees.com/release/"
    

    For SBT 0.7:

    lazy val liftModulesRelease = "liftmodules repository" at "http://repository-liftmodules.forge.cloudbees.com/release/"
    
  2. Include this dependency:

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

      net.liftmodules.basicauth.lib.BasicAuth.init
    
      BasicAuth.auth
    
  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
     liftmodules.basic.username=hello
     liftmodules.basic.password=hello
    

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

Something went wrong with that request. Please try again.