Fix tests to use GET to bypass CsrfFilter
This commit is contained in:
		
							parent
							
								
									4e61136948
								
							
						
					
					
						commit
						75e82e1b2c
					
				|  | @ -56,6 +56,7 @@ public class HelloWebSecurityApplicationTests { | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	public void requiresAuthentication() throws Exception { | 	public void requiresAuthentication() throws Exception { | ||||||
|  | 		this.request.setMethod("GET"); | ||||||
| 		this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain); | 		this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain); | ||||||
| 		assertThat(this.response.getStatus()) | 		assertThat(this.response.getStatus()) | ||||||
| 				.isEqualTo(HttpServletResponse.SC_UNAUTHORIZED); | 				.isEqualTo(HttpServletResponse.SC_UNAUTHORIZED); | ||||||
|  | @ -63,6 +64,7 @@ public class HelloWebSecurityApplicationTests { | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	public void userAuthenticates() throws Exception { | 	public void userAuthenticates() throws Exception { | ||||||
|  | 		this.request.setMethod("GET"); | ||||||
| 		this.request.addHeader("Authorization", | 		this.request.addHeader("Authorization", | ||||||
| 				"Basic " + new String(Base64.encode("user:password".getBytes("UTF-8")))); | 				"Basic " + new String(Base64.encode("user:password".getBytes("UTF-8")))); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue