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

Add CookieConfig to Csrf middleware #801

Open
fanie42 opened this issue Apr 13, 2024 · 0 comments
Open

Add CookieConfig to Csrf middleware #801

fanie42 opened this issue Apr 13, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@fanie42
Copy link

fanie42 commented Apr 13, 2024

Can we add CookieConfig to the Csrf middleware too? Mainly I would like to be able to change the csrf token cookie name. I don't know how applicable all of the fields are, but maybe it can just be copied from Session middleware?

let app = Route::new()
        .nest("/", api_service)
        .with(ServerSession::new(CookieConfig::new().name("my_session_id_cookie_name").secure(false), MemoryStorage::new()))
        .with(Csrf::new(CookieConfig::new().name("my_csrf_token_cookie_name").secure(false)));

EDIT: I might have been a bit misguided... Swagger UI uses a cookie for csrf, but that obviously shouldn't be used in production. You can close this one I think.

@fanie42 fanie42 added the enhancement New feature or request label Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant