|
99 | 99 | Two transport types are available: Cookies and Headers.
|
100 | 100 |
|
101 | 101 | ### <a name="cookies"></a>Why would I use Cookies?
|
102 |
| -Using Cookies to send session data has the advantage that is is handled automatically by client applications, like a web browser. |
| 102 | +Using Cookies to send session data has the advantage that it is handled automatically by client applications, like a web browser. |
103 | 103 | Also Cookies do not require you to implement a storage, since it's built-in into the browser already.
|
104 | 104 |
|
105 | 105 | The [Cookie transport example](https://github.com/softwaremill/akka-http-session-faq/tree/master/src/main/java/session/transport/CookieTransport.java) shows a typical setup for Cookies. Below is a sample use case:
|
@@ -128,7 +128,7 @@ Content-Length: 2
|
128 | 128 |
|
129 | 129 | ok
|
130 | 130 | ```
|
131 |
| -The response tells us to set the `_sesiondata` Cookie. |
| 131 | +The response tells us to set the `_sessiondata` Cookie. |
132 | 132 | ```
|
133 | 133 | $ curl -i --cookie "_sessiondata=625617AD3A82A95149B2DAAA6B4444F633F298E5-1505374699373-xmy_login" http://localhost:8080/api/current_login
|
134 | 134 |
|
@@ -691,7 +691,7 @@ my_login
|
691 | 691 | ### What is it and (when) do I need it?
|
692 | 692 | A CSRF attack is an attack, which tries to re-use a valid cookie to issue a request on your behalf.
|
693 | 693 | In short, you login to your bank account. A session Cookie is sent back to you.
|
694 |
| -Now with every request to the bank's site, the Cookie is send by the browser. |
| 694 | +Now with every request to the bank's site, the Cookie is sent by the browser. |
695 | 695 | If you open a new tab in your browser and navigate to a malicious web site you may find a prepared link.
|
696 | 696 | Clicking on that link will do a POST request to your bank's site.
|
697 | 697 | Since it is the bank's site, the session Cookie you received from your bank is also sent, hence the request is authorized.
|
|
752 | 752 | ```
|
753 | 753 | Notice we received a new `XSRF-TOKEN` value.
|
754 | 754 | This is achieved by the `setNewCsrfToken` directive.
|
755 |
| -This is recommended to prevent a (session fixation attack)[https://security.stackexchange.com/questions/22903/why-refresh-csrf-token-per-form-request]. |
| 755 | +This is recommended to prevent a [session fixation attack](https://security.stackexchange.com/questions/22903/why-refresh-csrf-token-per-form-request). |
756 | 756 | Now we can access the `/api/do_logout` endpoint:
|
757 | 757 | ```
|
758 | 758 | $ curl -i -X POST --cookie "_sessiondata=5DEF1181A728E6C1724D263B23A8ABAF859046A8-1506081618995-xmy_login;XSRF-TOKEN=mm10u06r81ltjqf7c62c0pn0pc7opssl7gm2ucckom5e4mp0gjsvhn8pa8vr8ula" -H "X-XSRF-TOKEN: mm10u06r81ltjqf7c62c0pn0pc7opssl7gm2ucckom5e4mp0gjsvhn8pa8vr8ula" http://localhost:8080/api/do_logout
|
|
0 commit comments