practicalli / practicalli/clojure-web-services
Compojure rest app and cookies
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 16
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/bakku/clj-rest-web-app
A session stores the currently logged in user ID, configured the ring-session middleware to use a cookie store. After restarting the server the session is refreshed as if it is not using any cookie store.
- configuring the cookie-store: https://github.com/bakku/clj-rest-web-app/blob/master/src/clj_rest_web_app/core.clj#L24
- setting the session after a successful login: https://github.com/bakku/clj-rest-web-app/blob/master/src/clj_rest_web_app/controllers/sessions.clj#L6
- running the application in docker, here I am setting the cookie secret: https://github.com/bakku/clj-rest-web-app/blob/master/docker-compose.yml#L15
By default Ring uses an in-memory session store. you can change it to store data in a cookie or something persistent like Redis
https://github.com/ring-clojure/ring/wiki/Sessions#session-stores (edited)
Its configured it to store the data in a cookie
using the site-defaults from ring which already wrapped my routes using the session middleware but the site-defaults are using the in-memory session. I had to update the session configuration of the site-defaults according to my needs to get it to work
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the session middleware configuration in src/clj_rest_web_app/core.clj and the session update in src/clj_rest_web_app/controllers/sessions.clj. Check docker-compose.yml for the cookie secret and compare the site-defaults session configuration with the Ring session-store guidance. Done means the logged-in user session remains available after restarting the application.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100