WebSessionServerCsrfTokenRepository session fixation protection
Issue: gh-4842
This commit is contained in:
parent
75a7c5268a
commit
b19e14330f
|
@ -61,6 +61,7 @@ public class WebSessionServerCsrfTokenRepository
|
|||
}
|
||||
return exchange.getSession()
|
||||
.doOnSuccess(session -> putToken(session.getAttributes(), token))
|
||||
.flatMap(session -> session.changeSessionId())
|
||||
.flatMap(r -> Mono.justOrEmpty(token));
|
||||
}
|
||||
|
||||
|
|
|
@ -102,4 +102,12 @@ public class WebSessionServerCsrfTokenRepositoryTests {
|
|||
load = this.repository.loadToken(this.exchange).block();
|
||||
assertThat(load).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void saveTokenChangeSessionId() {
|
||||
String originalSessionId = this.exchange.getSession().block().getId();
|
||||
this.repository.saveToken(this.exchange, null).block();
|
||||
WebSession session = this.exchange.getSession().block();
|
||||
assertThat(session.getId()).isNotEqualTo(originalSessionId);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue