Skip to content

Allow custom cookie consent value#40213

Merged
pranavkm merged 8 commits into
dotnet:mainfrom
daviddesmet:feat/cookie-consent-custom-value
Feb 15, 2022
Merged

Allow custom cookie consent value#40213
pranavkm merged 8 commits into
dotnet:mainfrom
daviddesmet:feat/cookie-consent-custom-value

Conversation

@daviddesmet
Copy link
Copy Markdown
Contributor

Allow customizing the cookie consent value

Allows setting a custom value for the cookie consent.

Description

Currently, the cookie consent validation performs an equality comparison against the constant cookie value yes. It will add more flexibility if the value can be customized, especially when supporting an already existing cookie consent.

Fixes #40164

@daviddesmet daviddesmet requested review from a team and Tratcher as code owners February 14, 2022 21:18
@ghost ghost added area-auth Includes: Authn, Authz, OAuth, OIDC, Bearer community-contribution Indicates that the PR has been added by a community member labels Feb 14, 2022
@dnfadmin
Copy link
Copy Markdown

dnfadmin commented Feb 14, 2022

CLA assistant check
All CLA requirements met.

Comment thread src/Security/CookiePolicy/src/ResponseCookiesWrapper.cs Outdated
@daviddesmet
Copy link
Copy Markdown
Contributor Author

@pranavkm The test CreateConsentCookieMatchesGrantConsentCookieWhenCookieValueIsMissing() will need to be updated since the ConsentCookieValue setter no longer accepts an empty value.

@pranavkm
Copy link
Copy Markdown
Contributor

Thanks. If you feel like it, it would be nice to add a test for CookieOptions to check it does not allow null / empty values for the consent value.

@Tratcher Tratcher added this to the 7.0-preview3 milestone Feb 14, 2022
@daviddesmet
Copy link
Copy Markdown
Contributor Author

@pranavkm Sure, I will add it!

@daviddesmet
Copy link
Copy Markdown
Contributor Author

@pranavkm @Tratcher Unit Test added when consent value is missing.

@pranavkm pranavkm enabled auto-merge (squash) February 14, 2022 22:31
@daviddesmet
Copy link
Copy Markdown
Contributor Author

@pranavkm The tests that failed didn't like 'ExceptionAssert.ThrowsArgument(Action, string, string)' :(

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

Labels

area-auth Includes: Authn, Authz, OAuth, OIDC, Bearer community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow customizing the cookie consent value

4 participants