- Sponsor
-
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
Open
schorsch
wants to merge
7
commits into
thoughtbot:main
Choose a base branch
from
schorsch:add_encrypted_cookie_option
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3be5f08
update argon2 to v2.2.0 gem due to errors loading argon2_wrap library…
schorsch a51eceb
add encrypt_cookie option in the same way as signed_cookie. using the…
schorsch 36cfc31
add encrypt_cookie option in the same way as signed_cookie. using the…
schorsch 49f801d
Merge remote-tracking branch 'origin/add_encrypted_cookie_option' int…
schorsch 5bfda9d
Merge branch 'main' into main
brian-penguin 3d19439
Merge branch 'thoughtbot:main' into main
schorsch 74c1dba
Merge branch 'main' into add_encrypted_cookie_option
schorsch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add encrypt_cookie option in the same way as signed_cookie. using the…
… new option overrides signed_cookie settings. no tests so far
- Loading branch information
commit 36cfc31ee7049e6adbe08ee4fae53fb6191d5f06
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,24 +108,44 @@ def cookies | |
|
||
# @api private | ||
def set_remember_token(token) | ||
case Clearance.configuration.signed_cookie | ||
when true, :migrate | ||
cookies.signed[remember_token_cookie] = cookie_options(token) | ||
when false | ||
cookies[remember_token_cookie] = cookie_options(token) | ||
if !Clearance.configuration.encrypted_cookie.nil? | ||
case Clearance.configuration.encrypted_cookie | ||
when true, :migrate | ||
cookies.encrypted[remember_token_cookie] = cookie_options(token) | ||
when false | ||
cookies[remember_token_cookie] = cookie_options(token) | ||
end | ||
else | ||
case Clearance.configuration.signed_cookie | ||
when true, :migrate | ||
cookies.signed[remember_token_cookie] = cookie_options(token) | ||
when false | ||
cookies[remember_token_cookie] = cookie_options(token) | ||
end | ||
end | ||
remember_token | ||
end | ||
|
||
# @api private | ||
def remember_token | ||
case Clearance.configuration.signed_cookie | ||
when true | ||
cookies.signed[remember_token_cookie] | ||
when :migrate | ||
cookies.signed[remember_token_cookie] || cookies[remember_token_cookie] | ||
when false | ||
cookies[remember_token_cookie] | ||
if !Clearance.configuration.encrypted_cookie.nil? | ||
case Clearance.configuration.encrypted_cookie | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Metrics/LineLength: Line is too long. [84/80] |
||
when false | ||
cookies[remember_token_cookie] | ||
end | ||
else | ||
case Clearance.configuration.signed_cookie | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Metrics/LineLength: Line is too long. [81/80] |
||
when false | ||
cookies[remember_token_cookie] | ||
end | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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]