Skip to content

Commit c51372b

Browse files
committed
WICKET-6786: reintroduced the configuration options from CsrfPreventionRequestCycleListener
1 parent 5d9d4b5 commit c51372b

File tree

6 files changed

+325
-56
lines changed

6 files changed

+325
-56
lines changed

wicket-core/src/main/java/org/apache/wicket/protocol/http/DefaultResourceIsolationPolicy.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,27 @@ public class DefaultResourceIsolationPolicy implements ResourceIsolationPolicy
3434
{
3535

3636
@Override
37-
public boolean isRequestAllowed(HttpServletRequest request, IRequestablePage targetPage)
37+
public ResourceIsolationOutcome isRequestAllowed(HttpServletRequest request,
38+
IRequestablePage targetPage)
3839
{
3940
// request made by a legacy browser with no support for Fetch Metadata
4041
if (!hasFetchMetadataHeaders(request))
4142
{
42-
return true;
43+
return ResourceIsolationOutcome.UNKNOWN;
4344
}
4445

4546
String site = request.getHeader(SEC_FETCH_SITE_HEADER);
4647

4748
// Allow same-site and browser-initiated requests
4849
if (SAME_ORIGIN.equals(site) || SAME_SITE.equals(site) || NONE.equals(site))
4950
{
50-
return true;
51+
return ResourceIsolationOutcome.ALLOWED;
5152
}
5253

5354
// Allow simple top-level navigations except <object> and <embed>
54-
return isAllowedTopLevelNavigation(request);
55+
return isAllowedTopLevelNavigation(request)
56+
? ResourceIsolationOutcome.ALLOWED
57+
: ResourceIsolationOutcome.DISALLOWED;
5558
}
5659

5760
private boolean isAllowedTopLevelNavigation(HttpServletRequest request)

0 commit comments

Comments
 (0)