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(sessions): store session's meatadata #13990

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

raoxiaoyan
Copy link
Contributor

@raoxiaoyan raoxiaoyan commented Dec 9, 2024

Summary

Engineering brief:
https://docs.google.com/document/d/1r7nSZGOlTVhupoVGQ6Ymqsaw64eGHKSMibko8FgrwAQ/edit?tab=t.0
### This PR won't bring a break change.
Add two new configurationshash_subject(by default false) and store_metadata(by default false). Please ref here.
Add a new table session_metadatas to store the session's metadata.

CREATE TABLE IF NOT EXISTS session_metadatas(
        id            uuid,
        session_id    uuid                    REFERENCES "sessions" ("id") ON DELETE CASCADE,
        sid           text,
        subject       text,
        audience      text,
        created_at    timestamp WITH TIME ZONE,
        PRIMARY KEY (id)
      );

Why to do this?
Please check this PR's ticket.

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

KM-788

@raoxiaoyan raoxiaoyan marked this pull request as draft December 9, 2024 02:30
@github-actions github-actions bot added plugins/session schema-change-noteworthy cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Dec 9, 2024
@raoxiaoyan raoxiaoyan force-pushed the feat/KM-788 branch 3 times, most recently from 30ce6e0 to 7158135 Compare December 16, 2024 07:30
@raoxiaoyan raoxiaoyan marked this pull request as ready for review December 18, 2024 23:36
@raoxiaoyan
Copy link
Contributor Author

@bungle Could you take a review for this PR, please?

@sumimakito
Copy link
Member

The changes in the pull request expose the controls on the hash_subject and store_metadata parameters from lua-resty-session, which look good to me.

@raoxiaoyan raoxiaoyan force-pushed the feat/KM-788 branch 2 times, most recently from 90fd87a to d94436f Compare December 26, 2024 01:59
@raoxiaoyan raoxiaoyan force-pushed the feat/KM-788 branch 2 times, most recently from 72c0fc6 to 66572c8 Compare December 27, 2024 03:07
@@ -0,0 +1,4 @@
message: |
**session**: Added two configurations `hash_subject` and `store_metadata` to store session's metadata.
Copy link
Contributor

@outsinre outsinre Dec 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**session**: Added two configurations `hash_subject` and `store_metadata` to store session's metadata.
**session**: Added two boolean configuration fields `hash_subject` (default `false`) and `store_metadata` (default `false`) to store session's metadata in the database.

kong/plugins/session/daos.lua Show resolved Hide resolved
@outsinre
Copy link
Contributor

If the session data is stored in the cookie, should we care about the session metadata?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee plugins/session schema-change-noteworthy size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants