-
Notifications
You must be signed in to change notification settings - Fork 6k
Add RememberMeDsl #9411
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 RememberMeDsl #9411
Conversation
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.
Thanks for the PR @IvanPavlov1995!
I left some comments inline.
config/src/main/kotlin/org/springframework/security/config/web/servlet/RememberMeDsl.kt
Outdated
Show resolved
Hide resolved
authenticationSuccessHandler?.also { rememberMe.authenticationSuccessHandler(authenticationSuccessHandler) } | ||
key?.also { rememberMe.key(key) } | ||
rememberMeServices?.also { rememberMe.rememberMeServices(rememberMeServices) } | ||
rememberMe.rememberMeParameter(rememberMeParameter) |
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.
We should only set this value if the user sets it in the Kotlin DSL.
Otherwise, we will let the Java DSL determine the default.
Similarly, for rememberMeCookieName
and alwaysRemember
.
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.
Done.
I have a question regarding also
syntax. Is there a reason not to use function reference in such configurations? I mean following is shorter and with that I don't have to use !!
operator:
useSecureCookie?.also(rememberMe::useSecureCookie)
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.
There is no particular reason. We could use function references instead. I will merge this PR as is, but feel free to create an additional PR if you think it's something we should change.
config/src/test/kotlin/org/springframework/security/config/web/servlet/RememberMeDslTest.kt
Outdated
Show resolved
Hide resolved
9e046bb
to
2ab0b8f
Compare
Issue: gh-9319