I'm attempting to add basic auth to a route using akka http 10.0.10 by doing the following:
def myUserPassAuthenticator(credentials: Credentials): Option[String] =
credentials match {
case p @ Credentials.Provided(id) if p.verify("p4ssw0rd") => Some(id)
case _ => None
}
val routes: Route =
pathPrefix("foo") {
authenticateBasic(realm = "secure site", myUserPassAuthenticator) { user =>
path("bar") {
pathEndOrSingleSlash {
complete("bla")
}
}
}
}
This compiles but IDEA is showing me the following error:
Type mismatch, expected L => server.Route, actual String => server.Route
Additionally loading localhost:9000/foo/bar returns a 404. Can anybody help me understand why this is and how to properly structure these directives?