-
-
Notifications
You must be signed in to change notification settings - Fork 467
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 encrypted cookie option #992
base: main
Are you sure you want to change the base?
Conversation
… with rubygems 3.4.6
… new option overrides signed_cookie settings. no tests so far
… new option overrides signed_cookie settings. no tests so far
…o add_encrypted_cookie_option # Conflicts: # lib/clearance/configuration.rb # lib/clearance/session.rb # spec/support/request_with_remember_token.rb
@@ -96,6 +96,12 @@ class Configuration | |||
# @return [Boolean|:migrate] | |||
attr_reader :signed_cookie | |||
|
|||
# Controls whether cookies are encrypted. | |||
# Defaults to `nil` for backwards compatibility. | |||
# When not nil overrides signed_cookie settings and if true uses Rails' encrypted cookies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [93/80]
when true | ||
cookies.signed[remember_token_cookie] | ||
when :migrate | ||
cookies.signed[remember_token_cookie] || cookies[remember_token_cookie] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [81/80]
when true | ||
cookies.encrypted[remember_token_cookie] | ||
when :migrate | ||
cookies.encrypted[remember_token_cookie] || cookies[remember_token_cookie] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [84/80]
My code may not be the most elaborate solution, but if it suits someone this could be a starting point.
There are no Unit-Test for it atm, but it works for me in a production app.