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

PrivateCookieJar for managing private cookies #900

Merged
merged 1 commit into from
Apr 1, 2022
Merged

Conversation

davidpdrsn
Copy link
Member

Fixes #896

Its pretty much identical to SignedCookieJar but private.

@davidpdrsn davidpdrsn requested a review from jplatte April 1, 2022 12:59
@davidpdrsn davidpdrsn enabled auto-merge (squash) April 1, 2022 12:59
@@ -15,6 +15,9 @@ use http::{
};
use std::{convert::Infallible, fmt, marker::PhantomData};

mod private;

pub use self::private::PrivateCookieJar;
Copy link
Member Author

Choose a reason for hiding this comment

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

Gonna move the plaintext and signed versions to their own mods in a follow up PR

Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

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

Since the underlying cookie library seems to have some support for this using CookieJar::private_jar and such, should we maybe have the ability to manage some plain, some signed / private cookies using a single jar?

@@ -32,7 +32,7 @@ axum-macros = { path = "../axum-macros", version = "0.2", optional = true }
serde = { version = "1.0", optional = true }
serde_json = { version = "1.0.71", optional = true }
percent-encoding = { version = "2.1", optional = true }
cookie-lib = { package = "cookie", version = "0.16", features = ["percent-encode", "signed"], optional = true }
cookie-lib = { package = "cookie", version = "0.16", features = ["percent-encode", "signed", "private"], optional = true }
Copy link
Member

Choose a reason for hiding this comment

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

Maybe pass through the features instead? I.e. have a signed-cookies feature that activates SignedCookieJar and cookie-lib/signed, equivalent for private / PrivateCookieJar.

Copy link
Member Author

Choose a reason for hiding this comment

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

I played around with some time ago but couldn't find a decent way of passing in the Key. You can get it manually via an extension and pass it in when passing .private_jar(key) but didn't like that too much 🤷

Copy link
Member Author

Choose a reason for hiding this comment

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

and yeah did think about adding separate features for enabling signed or private jars since it pulls in a few deps but thats a breaking change and we just shipped a new major yesterday :P

Copy link
Member

Choose a reason for hiding this comment

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

The -extra crate is separate for a reason, no? People sign up for frequent breaking changes when using it ^^

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah thats true :P

Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

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

Raised all questions I could think off, I'll you decide how to proceed with crate features and stuff like that.

@davidpdrsn davidpdrsn merged commit 01a4c88 into main Apr 1, 2022
@davidpdrsn davidpdrsn deleted the private-cookies branch April 1, 2022 14:37
@jplatte
Copy link
Member

jplatte commented Apr 1, 2022

Oh, I didn't realize auto-merge was enabled. Well, any changes can still be done in separate PRs 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Private Cookies to Axums Cookie Extension
2 participants