2015-05-11 23:05:18 +02:00
|
|
|
.. _-authenticateBasicPF-:
|
|
|
|
|
|
|
|
|
|
authenticateBasicPF
|
|
|
|
|
===================
|
|
|
|
|
|
|
|
|
|
Signature
|
|
|
|
|
---------
|
|
|
|
|
|
2015-10-01 13:25:41 +02:00
|
|
|
.. includecode:: /../../akka-http/src/main/scala/akka/http/scaladsl/server/directives/SecurityDirectives.scala#authenticator-pf
|
|
|
|
|
|
2015-06-19 15:35:24 +02:00
|
|
|
.. includecode2:: /../../akka-http/src/main/scala/akka/http/scaladsl/server/directives/SecurityDirectives.scala
|
2015-05-11 23:05:18 +02:00
|
|
|
:snippet: authenticateBasicPF
|
|
|
|
|
|
|
|
|
|
Description
|
|
|
|
|
-----------
|
2015-10-09 15:19:36 +02:00
|
|
|
Wraps the inner route with Http Basic authentication support using a given ``AuthenticatorPF[T]``.
|
2015-05-11 23:05:18 +02:00
|
|
|
|
2015-10-01 13:25:41 +02:00
|
|
|
Provides support for handling `HTTP Basic Authentication`_.
|
|
|
|
|
|
2015-10-08 15:20:17 +02:00
|
|
|
Refer to :ref:`-authenticateBasic-` for a detailed description of this directive.
|
|
|
|
|
|
|
|
|
|
Its semantics are equivalent to ``authenticateBasicPF`` 's, where not handling a case in the Partial Function (PF)
|
2015-10-01 13:25:41 +02:00
|
|
|
leaves the request to be rejected with a :class:`AuthenticationFailedRejection` rejection.
|
|
|
|
|
|
2015-10-09 15:19:36 +02:00
|
|
|
Longer-running authentication tasks (like looking up credentials in a database) should use :ref:`-authenticateBasicAsync-`
|
2015-10-01 13:25:41 +02:00
|
|
|
or :ref:`-authenticateBasicPFAsync-` if you prefer to use the ``PartialFunction`` syntax.
|
|
|
|
|
|
|
|
|
|
.. warning::
|
2015-10-08 15:20:17 +02:00
|
|
|
Make sure to use basic authentication only over SSL/TLS because credentials are transferred in plaintext.
|
2015-10-01 13:25:41 +02:00
|
|
|
|
|
|
|
|
.. _HTTP Basic Authentication: https://en.wikipedia.org/wiki/Basic_auth
|
2015-05-11 23:05:18 +02:00
|
|
|
|
|
|
|
|
Example
|
|
|
|
|
-------
|
|
|
|
|
|
2015-09-16 23:50:35 +02:00
|
|
|
.. includecode2:: ../../../../code/docs/http/scaladsl/server/directives/SecurityDirectivesExamplesSpec.scala
|
2015-10-08 15:20:17 +02:00
|
|
|
:snippet: authenticateBasicPF-0
|