use of jakarta.servlet.http.HttpServletRequest in project spring-security by spring-projects.
the class StrictHttpFirewallTests method getFirewalledRequestGetParameterWhenNameIsNullThenIllegalArgumentException.
// gh-9598
@Test
public void getFirewalledRequestGetParameterWhenNameIsNullThenIllegalArgumentException() {
HttpServletRequest request = this.firewall.getFirewalledRequest(this.request);
assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> request.getParameter(null));
}
use of jakarta.servlet.http.HttpServletRequest in project spring-security by spring-projects.
the class StrictHttpFirewallTests method getFirewalledRequestGetHeaderWhenNotAllowedHeaderValueThenException.
@Test
public void getFirewalledRequestGetHeaderWhenNotAllowedHeaderValueThenException() {
this.request.addHeader("good name", "bad value");
this.firewall.setAllowedHeaderValues((value) -> !value.equals("bad value"));
HttpServletRequest request = this.firewall.getFirewalledRequest(this.request);
assertThatExceptionOfType(RequestRejectedException.class).isThrownBy(() -> request.getHeader("good name"));
}
use of jakarta.servlet.http.HttpServletRequest in project spring-security by spring-projects.
the class StrictHttpFirewallTests method getFirewalledRequestGetParameterNamesWhenUndefinedCharacterInParameterNameThenException.
@Test
public void getFirewalledRequestGetParameterNamesWhenUndefinedCharacterInParameterNameThenException() {
this.request.addParameter("Bad\uFFFEName", "some value");
HttpServletRequest request = this.firewall.getFirewalledRequest(this.request);
assertThatExceptionOfType(RequestRejectedException.class).isThrownBy(request.getParameterNames()::nextElement);
}
use of jakarta.servlet.http.HttpServletRequest in project spring-security by spring-projects.
the class StrictHttpFirewallTests method getFirewalledRequestGetDateHeaderWhenNameIsNullThenNegativeOne.
@Test
public void getFirewalledRequestGetDateHeaderWhenNameIsNullThenNegativeOne() {
HttpServletRequest request = this.firewall.getFirewalledRequest(this.request);
assertThat(request.getDateHeader(null)).isEqualTo(-1);
}
use of jakarta.servlet.http.HttpServletRequest in project spring-security by spring-projects.
the class StrictHttpFirewallTests method getFirewalledRequestGetIntHeaderWhenControlCharacterInHeaderNameThenException.
@Test
public void getFirewalledRequestGetIntHeaderWhenControlCharacterInHeaderNameThenException() {
this.request.addHeader("Bad\0Name", "some value");
HttpServletRequest request = this.firewall.getFirewalledRequest(this.request);
assertThatExceptionOfType(RequestRejectedException.class).isThrownBy(() -> request.getIntHeader("Bad\0Name"));
}
Aggregations