Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate basic authentication #188

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/loader/KafkaManagerLoader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package loader
import controllers.KafkaManagerContext
import features.ApplicationFeatures
import models.navigation.Menus
import net.kaliber.basicAuthentication.BasicAuthenticationFilter
import play.api.ApplicationLoader
import play.api.ApplicationLoader.Context
import play.api.BuiltInComponentsFromContext
Expand Down Expand Up @@ -39,6 +40,8 @@ class ApplicationComponents(context: Context) extends BuiltInComponentsFromConte
private[this] lazy val assetsC = new controllers.Assets(httpErrorHandler)
private[this] lazy val webJarsAssetsC = new controllers.WebJarAssets(httpErrorHandler, context.initialConfiguration, context.environment)

override lazy val httpFilters = Seq(BasicAuthenticationFilter(context.initialConfiguration))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great if you can add configuration to enable it. Not everyone may want to enable it.


override val router: Router = new Routes(
httpErrorHandler,
applicationC,
Expand Down
5 changes: 4 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ assemblyMergeStrategy in assembly := {
case other => (assemblyMergeStrategy in assembly).value(other)
}

resolvers += "Kaliber Repository" at "https://jars.kaliber.io/artifactory/libs-release-local"

libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.3.14",
"com.typesafe.akka" %% "akka-slf4j" % "2.3.14",
Expand All @@ -39,7 +41,8 @@ libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "2.2.1" % "test",
"org.apache.curator" % "curator-test" % "2.9.1" % "test",
"org.mockito" % "mockito-core" % "1.10.19" % "test",
"com.yammer.metrics" % "metrics-core" % "2.2.0" force()
"com.yammer.metrics" % "metrics-core" % "2.2.0" force(),
"net.kaliber" %% "play-basic-authentication-filter" % "0.7"
)

routesGenerator := InjectedRoutesGenerator
Expand Down
3 changes: 3 additions & 0 deletions conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ pinned-dispatcher.type="PinnedDispatcher"
pinned-dispatcher.executor="thread-pool-executor"
application.features=["KMClusterManagerFeature","KMTopicManagerFeature","KMPreferredReplicaElectionFeature","KMReassignPartitionsFeature"]

basicAuthentication.username=username
basicAuthentication.password=password

akka {
loggers = ["akka.event.slf4j.Slf4jLogger"]
loglevel = "INFO"
Expand Down