Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

working example of iron-session with three protected pages #45

Closed
wants to merge 1 commit into from

Conversation

jduss4
Copy link
Contributor

@jduss4 jduss4 commented Mar 14, 2024

Changes proposed in this pull request:

Related to a portion of #22

  • adapted the typescript heavy example app from the iron-session repo. They have multiple, I picked this one because it was "recommended" by them and uses the app router.
  • currently just a draft PR so we can study it and figure out what we like or don't like

Things to check

  • Do the session checks make sense via different methods? Client component vs middleware vs server component?
  • Does it make sense how sessions are saved / updated / destroyed?

Also, I'm proactively sorry about the linting errors I'm sure are about to pop up, I can fix them all if we decide we kinda like this code.

Security considerations

None at the moment as this is just a demo app. However, we should consider what this might look like if implemented in our prototype and what additional security considerations we might have.

@jduss4 jduss4 requested review from hursey013 and echappen March 14, 2024 19:22
@jduss4
Copy link
Contributor Author

jduss4 commented Mar 14, 2024

This simpler demo offers some good reasoning about why more bells and whistles might be good: https://github.com/vvo/iron-session/blob/main/examples/next/src/app/app-router-client-component-redirect-route-handler-fetch/page.tsx#L68

The session is not updated between tabs and windows. If you login or logout in one window or tab, the others are still showing the previous state

@jduss4
Copy link
Contributor Author

jduss4 commented Mar 15, 2024

One thing that would be good to figure out if we were going to explore iron-session further is to figure out how to test if sessions are implemented (and consider how that might vary from this basic example of "username is set" vs a more complicated one of "there's a token and it matches something we're expecting or validates on an API call"), and see if that may change whether we prefer middleware checks vs client / server side etc.

@jduss4
Copy link
Contributor Author

jduss4 commented Mar 28, 2024

For now we are not going to worry about encrypting client side session information. @echappen has implemented page protections for logged in user access here: #57

@jduss4 jduss4 closed this Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant