I'm trying to change the org.apache.cxf.stax.maxChildElements value without
luck. How can I override the default value of 50,000? I've tried injecting
it as a jaxws:property on the endpoint and as a constructor property map
entry on the interceptor. Where should I be injecting it?
Here's my code:
<jaxws:endpoint
id="timeEndpoint"
implementor="#timeService"
address="/TimeService">
<jaxws:properties>
<entry
key="org.apache.cxf.stax.maxChildElements"
value="-1" />
</jaxws:properties>
<jaxws:inInterceptors>
<bean
id="securityInterceptor"
class="com.mycompany.WSS4JSecurityInterceptor">
<constructor-arg>
<map>
<entry
key="org.apache.cxf.stax.maxChildElements"
value="-1" />
</map>
</constructor-arg>
<property
name="usernameInterceptor"
ref="usernameInterceptor" />
<property
name="certificateInterceptor"
ref="certificateInterceptor" />
</bean>
</jaxws:inInterceptors>
</jaxws:endpoint>
<bean
id="usernameInterceptor"
class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<constructor-arg>
<map>
<entry
key="action"
value="UsernameToken" />
<entry
key="passwordType"
value="PasswordText" />
</map>
</constructor-arg>
</bean>
<bean
id="certificateInterceptor"
class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<constructor-arg>
<map>
<entry
key="action"
value="Signature" />
<entry
key="signaturePropFile"
value="server_sign.properties" />
</map>
</constructor-arg>
</bean>
public class WSS4JSecurityInterceptor extends WSS4JInInterceptor implements
InitializingBean {
private static final Logger logger =
LoggerFactory.getLogger(WSS4JSecurityInterceptor.class);
private WSS4JInInterceptor certificateInterceptor = null;
private WSS4JInInterceptor usernameInterceptor = null;
public void setCertificateInterceptor(WSS4JInInterceptor
certificateInterceptor) {
this.certificateInterceptor = certificateInterceptor;
}
public void setUsernameInterceptor(WSS4JInInterceptor
usernameInterceptor)
{
this.usernameInterceptor = usernameInterceptor;
}
public WSS4JSecurityInterceptor() {
super();
}
public WSS4JSecurityInterceptor(Map<String, Object> properties) {
super(properties);
}
@Override
public void afterPropertiesSet() throws Exception {
}
@Override
public void handleMessage(SoapMessage message) throws Fault {
SoapMessage messageClone = (SoapMessage) message.clone();
boolean authenticated = true;
try {
usernameInterceptor.handleMessage(messageClone);
} catch (Exception e) {
authenticated = false;
logger.debug("Username/password authentication failed");
}
if (authenticated) {
logger.info("Successfully authenticated using
username/password");
return;
}
authenticated = true;
try {
certificateInterceptor.handleMessage(message);
} catch (Exception e) {
authenticated = false;
logger.debug("Certificate authentication failed", e);
}
if (!authenticated) {
logger.error("Unable to authenticate!");
throw new AuthenticationException("Unable to
authenticate");
}
logger.info("Successfully authenticated using certificate");
}
}
--
View this message in context:
http://cxf.547215.n5.nabble.com/2-possible-validators-interceptors-tp5731252p5731284.html
Sent from the cxf-user mailing list archive at Nabble.com.