Man up and deal with CSRF in integration test

Fixes gh-979
This commit is contained in:
Dave Syer
2014-05-30 08:21:57 +01:00
parent ed0cfea6d2
commit 1d7caf8e31
4 changed files with 27 additions and 10 deletions

View File

@@ -73,10 +73,6 @@ public class SampleWebSecureApplication extends WebMvcConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
if (!security.isEnableCsrf()) {
// For testing
http.csrf().disable();
}
http.authorizeRequests().anyRequest().fullyAuthenticated().and().formLogin()
.loginPage("/login").failureUrl("/login?error").permitAll();
}

View File

@@ -27,7 +27,7 @@
</fieldset>
<input type="submit" id="login" value="Login"
class="btn btn-primary" /> <input type="hidden"
th:name="${_csrf.parameterName}" th:value="${_csrf.token}" th:if="${_csrf}"/>
th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
</form>
</div>
</div>