Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 900 Bytes

README.md

File metadata and controls

37 lines (26 loc) · 900 Bytes

playBasicAuthenticator

Simple BasicAuthentication for Play-Framework-Apps (implemented as Filter).

usage

  1. Add as dependecy to your project:

    libraryDependencies ++= Seq(
        "net.habashi" %% "basicauthenticator" % "1.0.0"
    )

    or

    lazy val myProject = project.dependsOn(basicauthenticator) 
  2. Extend HttpFilters and configure username/password for the BasicAuthenticator:

    class Filters @Inject()(implicit val mat: Materializer, ec: ExecutionContext) extends HttpFilters {
    
      val username = "sonic the hedgehog"
      val password = "rocks"
    
      override def filters = Seq(new BasicAuthenticationFilter(username, password))
    }
  3. Add the extended HttpFilters as Filter to the application.conf

    # Filters
    play.http.filters=net.habashi.filters.Filters