play-basic-auth


License

License

MIT
GroupId

GroupId

com.lambdaminute
ArtifactId

ArtifactId

play-basic-auth_2.12
Last Version

Last Version

0.1.15
Release Date

Release Date

Type

Type

jar
Description

Description

play-basic-auth
play-basic-auth
Project URL

Project URL

https://github.com/hejfelix/play-basic-auth
Project Organization

Project Organization

com.lambdaminute
Source Code Management

Source Code Management

https://github.com/hejfelix/play-basic-auth

Download play-basic-auth_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/com.lambdaminute/play-basic-auth_2.12/ -->
<dependency>
    <groupId>com.lambdaminute</groupId>
    <artifactId>play-basic-auth_2.12</artifactId>
    <version>0.1.15</version>
</dependency>
// https://jarcasting.com/artifacts/com.lambdaminute/play-basic-auth_2.12/
implementation 'com.lambdaminute:play-basic-auth_2.12:0.1.15'
// https://jarcasting.com/artifacts/com.lambdaminute/play-basic-auth_2.12/
implementation ("com.lambdaminute:play-basic-auth_2.12:0.1.15")
'com.lambdaminute:play-basic-auth_2.12:jar:0.1.15'
<dependency org="com.lambdaminute" name="play-basic-auth_2.12" rev="0.1.15">
  <artifact name="play-basic-auth_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.lambdaminute', module='play-basic-auth_2.12', version='0.1.15')
)
libraryDependencies += "com.lambdaminute" % "play-basic-auth_2.12" % "0.1.15"
[com.lambdaminute/play-basic-auth_2.12 "0.1.15"]

Dependencies

compile (2)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.3
com.typesafe.play : play_2.12 jar 2.6.3

test (2)

Group / Artifact Type Version
com.typesafe.play : play-test_2.12 jar 2.6.3
org.scalatest : scalatest_2.12 jar 3.0.3

Project Modules

There are no modules declared in this project.

play-basic-auth

Maven Central Build Status

forthebadge forthebadge forthebadge forthebadge

A basic auth filter for play

Dependencies

For now, this library is only built with scala2.12.x and play2.6.x. Pull requests are welcome.

Usage:

Add the latest version to your dependencies in build.sbt, replacing x.x.x with the newest version from Maven Central

libraryDependencies += "com.lambdaminute" %% "play-basic-auth" % "x.x.x"
//MyApplicationLoader.scala
package controllers

import com.lambdaminute.playbasicauth.{BasicAuthFilter, User}
import play.api.ApplicationLoader.Context
import play.api._
import router.Routes

class MyApplicationLoader extends ApplicationLoader {
  def load(context: Context) = {
    new MyComponents(context).application
  }
}

class MyComponents(context: Context)
    extends BuiltInComponentsFromContext(context)
    with AssetsComponents {

  val httpFilters = Seq(
    new BasicAuthFilter(List(User(name = "Horse", password = "carrot")), realm = "everything"))

  val homeController = new HomeController(controllerComponents)

  lazy val router = new Routes(httpErrorHandler, homeController, assets)

}
//application.conf
play.application.loader=controllers.MyApplicationLoader

More examples

Please refer to the tests

Versions

Version
0.1.15
0.1.10
0.1.9
0.1.0