From b12b006c03d6e08d9fb3a55ef5b6c0cb7d146b64 Mon Sep 17 00:00:00 2001 From: Zoo Sky Date: Wed, 18 Dec 2019 03:25:06 +0100 Subject: [PATCH] Add some docs and curl example (#211) --- cookie-auth/README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 cookie-auth/README.md diff --git a/cookie-auth/README.md b/cookie-auth/README.md new file mode 100644 index 00000000..01bd321a --- /dev/null +++ b/cookie-auth/README.md @@ -0,0 +1,26 @@ +# cookie-auth + +Testing with cookie auth with [curl](https://curl.haxx.se). + +Login: + + curl -v -b "auth-example=user1" -X POST http://localhost:8080/login + < HTTP/1.1 302 Found + < set-cookie: auth-example=GRm2Vku0UpFbJ3CNTKbndzIYHVGi8wc8eoXm/Axtf2BO; HttpOnly; Path=/ + < location: / + +Uses a POST request with a Useridentity `user1`. A cookie is set and a redirect to home `/` follows. + +Get: + +Now with the cookie `auth-example` sent in a GET request, the `user1` is recognized. + + curl -v -b "auth-example=GRm2Vku0UpFbJ3CNTKbndzIYHVGi8wc8eoXm/Axtf2BO" http://localhost:8080/ + * Connected to localhost (127.0.0.1) port 8080 (#0) + > GET / HTTP/1.1 + > Host: localhost:8080 + > Cookie: auth-example=GRm2Vku0UpFbJ3CNTKbndzIYHVGi8wc8eoXm/Axtf2BO + > + < HTTP/1.1 200 OK + < + Hello user1