-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allow customisation of the session object through new getSession
config
#8097
Open
borisno2
wants to merge
11
commits into
main
Choose a base branch
from
get-session
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
This comment was marked as resolved.
This comment was marked as resolved.
borisno2
force-pushed
the
get-session
branch
from
November 17, 2022 04:21
a403cfe
to
5ce0be4
Compare
borisno2
force-pushed
the
get-session
branch
from
November 17, 2022 04:26
5ce0be4
to
e3a26d6
Compare
borisno2
force-pushed
the
get-session
branch
from
November 17, 2022 04:32
e3a26d6
to
a2da72d
Compare
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit a8bfac8:
|
borisno2
force-pushed
the
get-session
branch
from
November 17, 2022 06:06
a2da72d
to
5cf4599
Compare
borisno2
force-pushed
the
get-session
branch
from
November 20, 2022 21:43
5cf4599
to
c80622a
Compare
dcousens
force-pushed
the
get-session
branch
2 times, most recently
from
November 22, 2022 07:25
c80622a
to
de0905c
Compare
borisno2
force-pushed
the
get-session
branch
from
November 23, 2022 23:29
7eb53fc
to
d00617b
Compare
borisno2
force-pushed
the
get-session
branch
from
November 24, 2022 05:25
d00617b
to
c0da55e
Compare
borisno2
force-pushed
the
get-session
branch
from
November 27, 2022 22:34
d53bff7
to
dad5c2c
Compare
borisno2
force-pushed
the
get-session
branch
from
November 29, 2022 04:45
c69d939
to
722e2b4
Compare
This was referenced May 5, 2023
borisno2
force-pushed
the
get-session
branch
2 times, most recently
from
August 13, 2023 08:27
498e351
to
fd292a7
Compare
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Josh Calder <[email protected]> Co-authored-by: Daniel Cousens <[email protected]>
Co-authored-by: mitchellhamilton <[email protected]>
Co-authored-by: Daniel Cousens <[email protected]>
…ds (#8698) Co-authored-by: Daniel Cousens <[email protected]>
Co-authored-by: Daniel Cousens <[email protected]>
Co-authored-by: Josh Calder <[email protected]>
dcousens
force-pushed
the
get-session
branch
from
September 10, 2023 23:49
a8bfac8
to
b494483
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR continues the context and session work from #8013
The goal of this PR to simplify how keystone handles different session implementations. With that in mind This PR does the following:
Moves
statelessSessions
andstoredSessions
functions into theauth
package.These Session Strategies are fairly simple cookie-based session management which do the following
start
- starts a session by setting a cookie on the serverres
and in the case ofstoredSessions
add the session data to the store.get
- decodes the data from the cookie inreq
returns data forcontext.session
andend
- sends a blank cookie back in the serverres
These functions are based around keystone handling the start and end of a session, however, this is not always the case - for example, SSO or other token-based auth.
By moving this more prescriptive session setup into auth the aim is to allow more complex auth and session management strategies to be implemented
This is a BREAKING change to config and means the following:
becomes:
session
config from main config intocreateAuth
sessionStrategy
config and movesessionData
intosessionStrategy
config - this means the following:Becomes:
Adds new
getSession
object toconfig
- removing currentsession
andsessionStrategy
With the current
session
andsessionStrategy
implementation moved to auth, Keystone still needs a way to populate thesession
object on thecontext
. In order to facilitate this a newgetSession
option is added toconfig
this passes the currentcontext
- which ifwithRequest
has been used will contain the currentreq
andres
- and accepts a function that returns a valid session, orundefined
if the session is not valid. The return ofgetSession
is added to thecontext
assession
.This should allow for easier configuration of more complex session strategies.