martin-g commented on a change in pull request #382: WICKET-6688 add RFC and
replace eval with DOM eval
URL: https://github.com/apache/wicket/pull/382#discussion_r322740717
##########
File path:
wicket-examples/src/main/java/org/apache/wicket/examples/csp/CspApplication.java
##########
@@ -45,9 +51,22 @@ protected void init()
{
super.init();
- setHeaderResponseDecorator(response -> new
ResourceAggregator(new CspNonceHeaderResponse(response, getNonce())));
+ // Decorate all header items with nonce
+ setHeaderResponseDecorator(response -> new ResourceAggregator(
+ isCspApplicable() ? new
CspNonceHeaderResponse(response, getNonce()) : response
+ ));
+ // add nonce to ajax response
+ getAjaxRequestTargetListeners().add((new
AjaxRequestTarget.IListener()
+ {
+ @Override
+ public void onBeforeRespond(Map<String, Component> map,
AjaxRequestTarget target)
+ {
+ target.addMeta("nonce", getNonce());
Review comment:
Should this be given some special name like `wicket-nonce` or
`<wicket:nonce>` ? Because `IPartialPageUpdateHandler#addMeta()` can be called
by the application and it can easily override this (add another) entry. Me, as
a user, I'd like to be notified somehow when my application code breaks somehow
the normal framework work.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services