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

feat: encode flow in cookie + URL params #3515

Merged
merged 106 commits into from
Jun 12, 2023
Merged

feat: encode flow in cookie + URL params #3515

merged 106 commits into from
Jun 12, 2023

Conversation

hperl
Copy link
Contributor

@hperl hperl commented May 12, 2023

This PR optimizes the performance of authorization code grant flows by minimizing the number of database queries. We acheive this by storing the flow in an AEAD-encoded cookie and AEAD-encoded request parameters for the authentication and consent screens.

Breaking changes

  • The client that is used as part of the authorization grant flow is stored in the AEAD-encoding. Therefore, running flows will not observe updates to the client after they were stared.
  • Because the login and consent challenge values now include the AEAD-encoded flow, their size increased to around 1kB for a flow without any metadata (and increases linearly with the amount of metadata).

@hperl hperl self-assigned this May 12, 2023
@hperl hperl requested a review from aeneasr as a code owner May 12, 2023 14:44
@hperl hperl marked this pull request as draft May 12, 2023 14:46
oauth2/flowctx/flowctx.go Outdated Show resolved Hide resolved
oauth2/flowctx/encoding.go Outdated Show resolved Hide resolved
aead/xchacha20.go Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
persistence/sql/persister_consent.go Outdated Show resolved Hide resolved
consent/sdk_test.go Outdated Show resolved Hide resolved
consent/sdk_test.go Outdated Show resolved Hide resolved
persistence/sql/persister_consent.go Outdated Show resolved Hide resolved
persistence/sql/persister_consent.go Show resolved Hide resolved
persistence/sql/persister_consent.go Show resolved Hide resolved
persistence/sql/persister_consent.go Show resolved Hide resolved
persistence/sql/persister_consent.go Show resolved Hide resolved
oauth2/flowctx/encoding.go Show resolved Hide resolved
persistence/sql/persister_oauth2.go Show resolved Hide resolved
@aeneasr
Copy link
Member

aeneasr commented Jun 9, 2023

@hperl two failing tests atm

@aeneasr
Copy link
Member

aeneasr commented Jun 9, 2023

Since we'll squash merge this anyways, I'll merge master into this branch.

@aeneasr aeneasr merged commit f29fe3a into master Jun 12, 2023
29 checks passed
@aeneasr aeneasr deleted the hperl/exp-flow-cookie branch June 12, 2023 18:27
hperl added a commit to ory/kratos that referenced this pull request Jun 14, 2023
For compatibility with ory/hydra#3515, which
now encodes the whole flow in the login challenge, we cannot further
assume that the challenge is a UUID.
hperl added a commit to ory/kratos that referenced this pull request Jun 14, 2023
For compatibility with ory/hydra#3515, which
now encodes the whole flow in the login challenge, we cannot further
assume that the challenge is a UUID.
hperl added a commit to ory/kratos that referenced this pull request Jun 14, 2023
For compatibility with ory/hydra#3515, which
now encodes the whole flow in the login challenge, we cannot further
assume that the challenge is a UUID.
hperl added a commit to ory/kratos that referenced this pull request Jun 14, 2023
For compatibility with ory/hydra#3515, which
now encodes the whole flow in the login challenge, we cannot further
assume that the challenge is a UUID.
hperl added a commit to ory/kratos that referenced this pull request Jun 15, 2023
For compatibility with ory/hydra#3515, which
now encodes the whole flow in the login challenge, we cannot further
assume that the challenge is a UUID.
hperl added a commit to ory/kratos that referenced this pull request Jun 15, 2023
For compatibility with ory/hydra#3515, which
now encodes the whole flow in the login challenge, we cannot further
assume that the challenge is a UUID.
hperl added a commit to ory/kratos that referenced this pull request Jun 15, 2023
For compatibility with ory/hydra#3515, which
now encodes the whole flow in the login challenge, we cannot further
assume that the challenge is a UUID.
hperl added a commit to ory/kratos that referenced this pull request Jun 16, 2023
For compatibility with ory/hydra#3515, which
now encodes the whole flow in the login challenge, we cannot further
assume that the challenge is a UUID.
hperl added a commit to ory/kratos that referenced this pull request Jun 16, 2023
For compatibility with ory/hydra#3515, which
now encodes the whole flow in the login challenge, we cannot further
assume that the challenge is a UUID.
hperl added a commit to ory/kratos that referenced this pull request Jun 16, 2023
For compatibility with ory/hydra#3515, which
now encodes the whole flow in the login challenge, we cannot further
assume that the challenge is a UUID.
hperl added a commit to ory/kratos that referenced this pull request Jun 16, 2023
For compatibility with ory/hydra#3515, which
now encodes the whole flow in the login challenge, we cannot further
assume that the challenge is a UUID.
hperl added a commit to ory/kratos that referenced this pull request Jun 16, 2023
For compatibility with ory/hydra#3515, which
now encodes the whole flow in the login challenge, we cannot further
assume that the challenge is a UUID.
aeneasr pushed a commit to ory/kratos that referenced this pull request Jun 19, 2023
For compatibility with ory/hydra#3515, which
now encodes the whole flow in the login challenge, we cannot further
assume that the challenge is a UUID.
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.

None yet

3 participants