Hi Johan,
I certainly have read it, but I think my application works differently then the way supported by RA. I'm now trying to adjust my application a little to accomodate for that, but it's still not working.
I believe the main problem is sessions. A CSRF token is stored in the session, but RA doesn't create one. When trying to POST to a csrf protected endpoint, the response will be a default spring one, stating that there was no csrf token in the session.
{
"timestamp": 1450610468234,
"status": 403,
"error": "Forbidden",
"message": "Expected CSRF token not found. Has your session expired?",
"path": "/teams"
}
I tried solving this by creating a session before the test:
protected void createSession() {
Response tokenResponse = given().log().all().filter(sessionFilter).
get("/token").
then().log().all().
extract().response();
sessionFilter.getSessionId();
}
But then it's not picked up (because RA just tries posting again, instead of authenticating first) and I get another standard Spring response, again without CSRF token
{
"timestamp": 1450610601703,
"status": 403,
"error": "Forbidden",
"message": "Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-CSRF-TOKEN'.",
"path": "/teams"
}
I have no idea what RA is expecting for it to pick up the CSRF tokens. If it just keeps blindly posting before doing authentication, that's never going to work right?
Op zaterdag 19 december 2015 20:21:40 UTC+1 schreef Johan Haleby: