Skip to content

Commit 2ff964d

Browse files
author
Valentin Brückel
committed
Added CSRF logging in mismatch case
1 parent a911e0b commit 2ff964d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/main/java/com/predic8/membrane/core/interceptor/oauth2client/rf/OAuth2CallbackRequestHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import static com.predic8.membrane.core.Constants.*;
3636
import static com.predic8.membrane.core.http.Header.*;
3737
import static com.predic8.membrane.core.http.MimeType.*;
38+
import static com.predic8.membrane.core.interceptor.oauth2.ParamNames.STATE;
3839
import static com.predic8.membrane.core.interceptor.oauth2client.rf.JsonUtils.isJson;
3940
import static com.predic8.membrane.core.interceptor.oauth2client.rf.StateManager.*;
4041
import static com.predic8.membrane.core.interceptor.oauth2client.temp.OAuth2Constants.*;
@@ -100,7 +101,8 @@ public boolean handleRequest(Exchange exc, Session session) throws Exception {
100101
"MEMBRANE_CSRF_TOKEN_MISSING_IN_SESSION",
101102
MEMBRANE_CSRF_TOKEN_MISSING_IN_SESSION,
102103
Response.badRequest().body(MEMBRANE_CSRF_TOKEN_MISSING_IN_SESSION).build());
103-
}else {
104+
} else {
105+
log.warn("Token from Session: '{}', Token from URI: '{}'", session.get(STATE).toString(), stateFromUri);
104106
throw new OAuth2Exception(
105107
"MEMBRANE_CSRF_TOKEN_MISMATCH",
106108
MEMBRANE_CSRF_TOKEN_MISMATCH,

0 commit comments

Comments
 (0)