Skip to content

Commit

Permalink
add setter for using a custom name for the rememberMeParameter
Browse files Browse the repository at this point in the history
  • Loading branch information
BigMichi1 authored and Rob Winch committed Feb 25, 2015
1 parent cd352f6 commit c8b7928
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Expand Up @@ -162,6 +162,17 @@ public RememberMeConfigurer<H> key(String key) {
return this;
}

/**
* The HTTP parameter used to indicate to remember the user at time of login.
*
* @param rememberMeParameter the HTTP parameter used to indicate to remember the user
* @return the {@link RememberMeConfigurer} for further customization
*/
public RememberMeConfigurer<H> rememberMeParameter(String rememberMeParameter) {
this.rememberMeParameter = rememberMeParameter;
return this;
}

/**
* Allows control over the destination a remembered user is sent to when they are successfully authenticated.
* By default, the filter will just allow the current request to proceed, but if an
Expand Down
Expand Up @@ -252,6 +252,24 @@ public class NamespaceRememberMeTests extends BaseSpringSpec {
ReflectionTestUtils.getField(findFilter(RememberMeAuthenticationFilter).rememberMeServices, "useSecureCookie") == true
}

@Configuration
static class RememberMeParameterConfig extends BaseWebConfig {
protected void configure(HttpSecurity http) throws Exception {
http
.formLogin()
.and()
.rememberMe()
.rememberMeParameter("rememberMe")
}
}

def "http/remember-me@remember-me-parameter"() {
when: "use custom rememberMeParameter"
loadConfig(RememberMeParameterConfig)
then: "custom rememberMeParameter will be used"
findFilter(RememberMeAuthenticationFilter).rememberMeServices.parameter == "rememberMe"
}

@Configuration
static class UseSecureCookieConfig extends BaseWebConfig {
protected void configure(HttpSecurity http) throws Exception {
Expand Down

0 comments on commit c8b7928

Please sign in to comment.