* #20535 add checkSameOrigin directive to WebSocketDirectives * refactoring + add docs * refactoring + cleanup in docs * fix types and conversions in the InvalidOriginHeaderRejection * simplify InvalidOriginHeaderRejection to InvalidOriginRejection
This commit is contained in:
parent
8ba36be6c4
commit
0eda4075ef
16 changed files with 237 additions and 27 deletions
|
|
@ -0,0 +1,17 @@
|
|||
.. _-checkSameOrigin-java-:
|
||||
|
||||
checkSameOrigin
|
||||
===============
|
||||
|
||||
Description
|
||||
-----------
|
||||
Checks that request comes from the same origin. Extracts the ``Origin`` header value and verifies that allowed range
|
||||
contains the obtained value. In the case of absent of the ``Origin`` header rejects with a ``MissingHeaderRejection``.
|
||||
If the origin value is not in the allowed range rejects with an ``InvalidOriginHeaderRejection``
|
||||
and ``StatusCodes.FORBIDDEN`` status.
|
||||
|
||||
Example
|
||||
-------
|
||||
Checking the ``Origin`` header:
|
||||
|
||||
.. includecode:: ../../../../code/docs/http/javadsl/server/directives/HeaderDirectivesExamplesTest.java#checkSameOrigin
|
||||
|
|
@ -17,3 +17,4 @@ response headers use one of the :ref:`RespondWithDirectives-java`.
|
|||
optionalHeaderValueByName
|
||||
optionalHeaderValueByType
|
||||
optionalHeaderValuePF
|
||||
checkSameOrigin
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue