Ich habe Spring Security Header aktiviert. Standardmäßig ist X-FRAME-OPTIONS
DENY
. Aber für einige Antworten sollte ich X-FRAME-OPTIONS
als SAMEORIGIN
aktivieren. Ich habe versucht, Anfrage Matcher hinzuzufügen. Aber es fügt beide als X-Frame-Options
(DENY
, SAMEORIGIN
) hinzu. Wie vermeide ich Standard (DENY
) für Request Matcher?Wie Sie X-FRAME-OPTIONS einigen Seiten in Spring Security-Kopfzeilen (Spring-Version 4.2.0) hinzufügen?
Mein Code ist wie folgt:
<security:headers disabled="false">
<security:header ref="xFrameOptionsHeaderWriter"/>
<security:content-security-policy policy-directives="script-src 'self' 'unsafe-inline' 'unsafe-eval'" />
<security:cache-control disabled="true"/>
</security:headers>
<bean id="xFrameOptionsHeaderWriter" class="org.springframework.security.web.header.writers.DelegatingRequestMatcherHeaderWriter">
<constructor-arg>
<bean class="org.springframework.security.web.util.matcher.NegatedRequestMatcher">
<constructor-arg>
<bean class="org.springframework.security.web.util.matcher.OrRequestMatcher">
<constructor-arg>
<list>
<bean class="org.springframework.security.web.util.matcher.AntPathRequestMatcher">
<constructor-arg value="/**/flows/javax.faces.resource/dynamiccontent.properties/**" />
</bean>
</list>
</constructor-arg>
</bean>
</constructor-arg>
</bean>
</constructor-arg>
<constructor-arg>
<bean class="org.springframework.security.web.header.writers.frameoptions.XFrameOptionsHeaderWriter">
<constructor-arg value="SAMEORIGIN"/>
</bean>
</constructor-arg>
</bean>