Skip to content

Conversation

@schorsch
Copy link
Contributor

  • adds the option to encrypt the cookie containing the remember token
  • implemented on the same schema as signed_cookie method
  • overrides the signed_cookie setting of booth are present

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.

schorsch and others added 7 commits March 8, 2023 11:34
… 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

# 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
Copy link

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]
Copy link

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]
Copy link

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]

@schorsch schorsch requested a review from sej3506 as a code owner May 8, 2024 19:12
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.

2 participants