Generalised Authentication Directives to accept Bearer Tokens
Make type of credential authentication explicit Cleanup
This commit is contained in:
parent
8d72e30235
commit
4dde089d82
9 changed files with 276 additions and 55 deletions
|
|
@ -5,7 +5,7 @@
|
|||
package akka.http.scaladsl.server
|
||||
|
||||
import akka.http.scaladsl.marshallers.xml.ScalaXmlSupport
|
||||
import akka.http.scaladsl.server.directives.UserCredentials
|
||||
import akka.http.scaladsl.server.directives.Credentials
|
||||
import com.typesafe.config.{ ConfigFactory, Config }
|
||||
import akka.actor.ActorSystem
|
||||
import akka.stream.ActorMaterializer
|
||||
|
|
@ -23,7 +23,7 @@ object TestServer extends App {
|
|||
import Directives._
|
||||
|
||||
def auth: AuthenticatorPF[String] = {
|
||||
case p @ UserCredentials.Provided(name) if p.verifySecret(name + "-password") ⇒ name
|
||||
case p @ Credentials.Provided(name) if p.verify(name + "-password") ⇒ name
|
||||
}
|
||||
|
||||
val bindingFuture = Http().bindAndHandle({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue