title: Akka Authentication with REST Http
body: <p>I'm testing Json HTTP Routes with Akka Basic Authentication and scala. But the routes don't work as needed. Here is the code</p>
  
  <p>First the secured route is not working with postman BasicAuth. I need to add an email"secured/test@test.com" to trigger the logged in action. Second the subroute basketactor is not working at all. Postman says unknown Route. So how can i make this work with Postman BasicAuth Http Header? What kind of request do i have to send just "secured or with email and password together.
  Second how can i make the subroutes basketActor/add work. </p>
  
  <pre><code>~ Route.seal {
            (pathPrefix("secured") &amp; get) {
              authenticateBasic(realm = "secure site", myUserPassAuthenticator) { email =&gt;
                path(Segment) { segment =&gt;
                  var user = User.USER_LIST.find(_.id == segment)
                  if (user.isDefined)
                    complete(s"Hi '$email' you logged in")
                  else complete(s"login failed Please register at ${"users" / "register"}")
                }
              } ~ path("basketActor") {
                (pathEnd &amp; get) {
                  implicit val timeout = Timeout(3 seconds)
                  onSuccess((basketActor ? GetBasketProducts).mapTo[BasketList]) { res =&gt;
                    complete(BasketContainer(products = res.products))
                  }
                } ~ (path("add" / IntNumber) &amp; post) { number =&gt;
                  val product = Product.PRODUCT_LIST.find(_.id == number)
                  if (product.isDefined) {
                    product.foreach { product =&gt;
                      basketActor ! AddProductToBasket(product)
                      //            complete(Basket.BASKET_LIST ::= product)
                    }
                    complete(product)
                  } else complete("Not found")
                }
              }
            }
        }
  </code></pre>
  
  <pre><code> def myUserPassAuthenticator(credentials: Credentials): Option[String] =
        credentials match {
          case p@Credentials.Provided(id) if p.verify("secret") =&gt; Some(id)
          case _ =&gt; None
        }
  
  </code></pre>
  
  <p>So my expected result should be the user calls the secured Route logs in and then he can access the basketActor route. But now the route is not accessible and the secured route is also not working</p>