Author: sergeyb
Date: 2010-07-01 13:39:42 -0400 (Thu, 01 Jul 2010)
New Revision: 12565
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFNonSpringServletExt.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/AuthenticationManagerLoader.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingInterceptor.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/callback/UsernameTokenCallback.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/callback/UsernameTokenCallbackHandler.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/nonce/NonceStore.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java
Log:
[JBWS-3078] : some formatting fixes
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFNonSpringServletExt.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFNonSpringServletExt.java 2010-07-01
17:14:50 UTC (rev 12564)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFNonSpringServletExt.java 2010-07-01
17:39:42 UTC (rev 12565)
@@ -46,26 +46,27 @@
public class CXFNonSpringServletExt extends CXFNonSpringServlet
{
protected Endpoint endpoint;
-
+
@Override
public ServletController createServletController(ServletConfig servletConfig)
{
- ServletTransportFactory stf =
(ServletTransportFactory)createServletTransportFactory();
+ ServletTransportFactory stf = (ServletTransportFactory)
createServletTransportFactory();
return new ServletControllerExt(stf, servletConfig,
servletConfig.getServletContext(), bus);
}
-
+
@Override
- public void loadBus(ServletConfig servletConfig) throws ServletException {
+ public void loadBus(ServletConfig servletConfig) throws ServletException
+ {
//Init the Endpoint
endpoint = ServletHelper.initEndpoint(servletConfig, getServletName());
-
+
//keep the bus created during deployment and update it with the information coming
from the servlet config
updateAvailableBusWithServletInfo(servletConfig);
-
+
//register the InstrumentManagementImpl
ServletHelper.registerInstrumentManger(bus, getServletContext());
}
-
+
private void updateAvailableBusWithServletInfo(ServletConfig servletConfig)
{
BusHolder holder =
endpoint.getService().getDeployment().getAttachment(BusHolder.class);
@@ -81,7 +82,7 @@
//set the controller in the servlet context now that the bus has been configured in
the servlet
servletConfig.getServletContext().setAttribute(ServletController.class.getName(),
getController());
}
-
+
@Override
protected void invoke(HttpServletRequest req, HttpServletResponse res) throws
ServletException
{
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2010-07-01
17:14:50 UTC (rev 12564)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/CXFServletExt.java 2010-07-01
17:39:42 UTC (rev 12565)
@@ -49,7 +49,7 @@
@Override
public ServletController createServletController(ServletConfig servletConfig)
{
- ServletTransportFactory stf =
(ServletTransportFactory)createServletTransportFactory();
+ ServletTransportFactory stf = (ServletTransportFactory)
createServletTransportFactory();
return new ServletControllerExt(stf, servletConfig,
servletConfig.getServletContext(), bus);
}
@@ -58,14 +58,14 @@
{
//Init the Endpoint
endpoint = ServletHelper.initEndpoint(servletConfig, getServletName());
-
+
//keep the bus created during deployment and update it with the information coming
from the servlet config
updateAvailableBusWithServletInfo(servletConfig);
-
+
//register the InstrumentManagementImpl
ServletHelper.registerInstrumentManger(bus, getServletContext());
}
-
+
private void updateAvailableBusWithServletInfo(ServletConfig servletConfig)
{
BusHolder holder =
endpoint.getService().getDeployment().getAttachment(BusHolder.class);
@@ -87,6 +87,5 @@
{
ServletHelper.callRequestHandler(req, res, getServletContext(), getBus(),
endpoint);
}
-
-
+
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2010-07-01
17:14:50 UTC (rev 12564)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2010-07-01
17:39:42 UTC (rev 12565)
@@ -95,8 +95,8 @@
* @param depEndpoints The list of deployment endpoints
* @return The new jbossws cxf configurer
*/
- public abstract Configurer createServerConfigurer(BindingCustomization customization,
WSDLFilePublisher wsdlPublisher,
- List<Endpoint> depEndpoints);
+ public abstract Configurer createServerConfigurer(BindingCustomization customization,
+ WSDLFilePublisher wsdlPublisher, List<Endpoint> depEndpoints);
protected static void setInterceptors(Bus bus)
{
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java 2010-07-01
17:14:50 UTC (rev 12564)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/NonSpringBusHolder.java 2010-07-01
17:39:42 UTC (rev 12565)
@@ -53,8 +53,9 @@
public class NonSpringBusHolder extends BusHolder
{
private boolean configured = false;
+
protected DDBeans metadata;
-
+
public NonSpringBusHolder(DDBeans metadata)
{
super();
@@ -64,11 +65,12 @@
ExtensionManager em = bus.getExtension(ExtensionManager.class);
em.activateAllByType(ConduitInitiator.class); //need to activate/register all the
beans implementing ConduitInitiator so that does not happen later
DestinationFactory factory = new ServletTransportFactory(bus);
- for (String s : factory.getTransportIds()) {
- registerTransport(factory, s);
+ for (String s : factory.getTransportIds())
+ {
+ registerTransport(factory, s);
}
}
-
+
/**
* Update the Bus held by the this instance using the provided parameters.
* This basically prepares the bus for being used with JBossWS.
@@ -85,11 +87,11 @@
throw new IllegalStateException("Underlying bus is already configured for
JBossWS use!");
}
super.configure(soapTransportFactory, resolver, configurer);
-
+
for (DDEndpoint dde : metadata.getEndpoints())
{
EndpointImpl endpoint = new EndpointImpl(bus,
newInstance(dde.getImplementor()));
- endpoint.setInvoker((Invoker)newInstance(dde.getInvoker()));
+ endpoint.setInvoker((Invoker) newInstance(dde.getInvoker()));
endpoint.setAddress(dde.getAddress());
endpoint.setEndpointName(dde.getPortName());
endpoint.setServiceName(dde.getServiceName());
@@ -104,7 +106,7 @@
}
configured = true;
}
-
+
private static Object newInstance(String className)
{
try
@@ -117,10 +119,10 @@
throw new RuntimeException(e);
}
}
-
+
@Override
public Configurer createServerConfigurer(BindingCustomization customization,
WSDLFilePublisher wsdlPublisher,
- List<Endpoint> depEndpoints)
+ List<Endpoint> depEndpoints)
{
ServerBeanCustomizer customizer = new ServerBeanCustomizer();
customizer.setBindingCustomization(customization);
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2010-07-01
17:14:50 UTC (rev 12564)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/ServerBeanCustomizer.java 2010-07-01
17:39:42 UTC (rev 12565)
@@ -38,37 +38,38 @@
public class ServerBeanCustomizer extends BeanCustomizer
{
private WSDLFilePublisher wsdlPublisher;
+
private List<Endpoint> depEndpoints;
-
+
@Override
public void customize(Object beanInstance)
{
if (beanInstance instanceof EndpointImpl)
{
- configureEndpoint((EndpointImpl)beanInstance);
- }
+ configureEndpoint((EndpointImpl) beanInstance);
+ }
if (beanInstance instanceof ServerFactoryBean)
{
- ServerFactoryBean factory = (ServerFactoryBean)beanInstance;
-
- if (factory.getInvoker() instanceof AbstractInvoker)
- {
- ((AbstractInvoker)factory.getInvoker()).setTargetBean(factory.getServiceBean());
- }
- if (depEndpoints != null)
- {
- for (Endpoint depEndpoint : depEndpoints)
- {
- if (depEndpoint.getTargetBeanClass() == factory.getServiceBean().getClass())
- {
- depEndpoint.addAttachment(ServerFactoryBean.class, factory);
- }
- }
- }
+ ServerFactoryBean factory = (ServerFactoryBean) beanInstance;
+
+ if (factory.getInvoker() instanceof AbstractInvoker)
+ {
+ ((AbstractInvoker)
factory.getInvoker()).setTargetBean(factory.getServiceBean());
+ }
+ if (depEndpoints != null)
+ {
+ for (Endpoint depEndpoint : depEndpoints)
+ {
+ if (depEndpoint.getTargetBeanClass() ==
factory.getServiceBean().getClass())
+ {
+ depEndpoint.addAttachment(ServerFactoryBean.class, factory);
+ }
+ }
+ }
}
super.customize(beanInstance);
}
-
+
protected void configureEndpoint(EndpointImpl endpoint)
{
//Configure wsdl file publisher
@@ -77,15 +78,15 @@
endpoint.setWsdlPublisher(wsdlPublisher);
}
}
-
+
public void setWsdlPublisher(WSDLFilePublisher wsdlPublisher)
{
this.wsdlPublisher = wsdlPublisher;
}
- public void setDeploymentEndpoints(List<Endpoint> endpoints)
+ public void setDeploymentEndpoints(List<Endpoint> endpoints)
{
- this.depEndpoints = endpoints;
+ this.depEndpoints = endpoints;
}
-
+
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java 2010-07-01
17:14:50 UTC (rev 12564)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java 2010-07-01
17:39:42 UTC (rev 12565)
@@ -55,18 +55,22 @@
public class SpringBusHolder extends BusHolder
{
private static final Logger log = Logger.getLogger(BusHolder.class);
+
private boolean configured = false;
- protected BusApplicationContext ctx ;
+
+ protected BusApplicationContext ctx;
+
protected List<GenericApplicationContext> additionalCtx = new
LinkedList<GenericApplicationContext>();
+
protected URL[] additionalLocations;
-
+
public SpringBusHolder(URL location, URL... additionalLocations)
{
super();
this.additionalLocations = additionalLocations;
createBus(location);
}
-
+
/**
* Creates the Bus using a SpringBusFactory with no specific Spring application
context.
* Then loads additional configurations from the provided location
@@ -93,11 +97,12 @@
}
//Force servlet transport to prevent CXF from using Jetty as a transport
DestinationFactory factory = new ServletTransportFactory(bus);
- for (String s : factory.getTransportIds()) {
- registerTransport(factory, s);
+ for (String s : factory.getTransportIds())
+ {
+ registerTransport(factory, s);
}
}
-
+
/**
* Update the Bus held by the this instance using the provided parameters.
* This basically prepares the bus for being used with JBossWS.
@@ -130,10 +135,10 @@
}
configured = true;
}
-
+
@Override
public Configurer createServerConfigurer(BindingCustomization customization,
WSDLFilePublisher wsdlPublisher,
- List<Endpoint> depEndpoints)
+ List<Endpoint> depEndpoints)
{
ApplicationContext ctx = bus.getExtension(BusApplicationContext.class);
ServerBeanCustomizer customizer = new ServerBeanCustomizer();
@@ -144,10 +149,12 @@
serverConfigurer.setCustomizer(customizer);
return serverConfigurer;
}
-
- protected static GenericApplicationContext loadAdditionalConfig(ApplicationContext
ctx, URL locationUrl) throws IOException
+
+ protected static GenericApplicationContext loadAdditionalConfig(ApplicationContext
ctx, URL locationUrl)
+ throws IOException
{
- if (locationUrl == null) throw new IllegalArgumentException("Cannot load
additional config from null location!");
+ if (locationUrl == null)
+ throw new IllegalArgumentException("Cannot load additional config from null
location!");
InputStream is = locationUrl.openStream();
GenericApplicationContext childCtx = new GenericApplicationContext(ctx);
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(childCtx);
@@ -157,7 +164,7 @@
childCtx.refresh();
return childCtx;
}
-
+
/**
* Performs close operations (currently implies destroying additional contexts)
*
@@ -171,7 +178,7 @@
}
super.close();
}
-
+
@Override
protected void setBus(Bus bus)
{
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/AuthenticationManagerLoader.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/AuthenticationManagerLoader.java 2010-07-01
17:14:50 UTC (rev 12564)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/AuthenticationManagerLoader.java 2010-07-01
17:39:42 UTC (rev 12565)
@@ -41,12 +41,12 @@
{
Context ctx = new InitialContext();
Object obj = ctx.lookup("java:/comp/env/security/securityMgr");
- return (AuthenticationManager)obj;
+ return (AuthenticationManager) obj;
}
catch (NamingException ne)
{
throw new SecurityException("Unable to lookup AuthenticationManager using
JNDI");
}
}
-
+
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingInterceptor.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingInterceptor.java 2010-07-01
17:14:50 UTC (rev 12564)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/SubjectCreatingInterceptor.java 2010-07-01
17:39:42 UTC (rev 12565)
@@ -56,17 +56,23 @@
public class SubjectCreatingInterceptor extends
AbstractUsernameTokenAuthenticatingInterceptor
{
private static final Logger log = Logger.getLogger(SubjectCreatingInterceptor.class);
+
private static final int TIMESTAMP_FRESHNESS_THRESHOLD = 300;
-
+
private AuthenticationManagerLoader aml;
+
private boolean propagateContext;
+
private SecurityAdaptorFactory secAdaptorFactory;
+
private int timestampThreshold = TIMESTAMP_FRESHNESS_THRESHOLD;
- private NonceStore nonceStore;
+
+ private NonceStore nonceStore;
+
private boolean decodeNonce = true;
private boolean supportDigestPasswords;
-
+
public SubjectCreatingInterceptor()
{
this(Collections.<String, Object> emptyMap());
@@ -93,50 +99,54 @@
// TODO : this code is a temporarily workaround;
AbstractUsernameTokenAuthenticatingInterceptor
// has a bug to do with handling digests; RequestData assumes PasswordDigest by
default
@Override
- public void setSupportDigestPasswords(boolean support) {
- this.supportDigestPasswords = support;
- super.setSupportDigestPasswords(support);
+ public void setSupportDigestPasswords(boolean support)
+ {
+ this.supportDigestPasswords = support;
+ super.setSupportDigestPasswords(support);
}
-
+
// TODO : this code is a temporarily workaround;
AbstractUsernameTokenAuthenticatingInterceptor
// has a bug to do with handling digests; RequestData assumes PasswordDigest by
default
@Override
- protected CallbackHandler getCallback(RequestData reqData, int doAction)
- throws WSSecurityException {
-
- if (supportDigestPasswords) {
- return new CallbackHandler()
- {
- @Override
- public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException
- {
- // dummy handler
- }
- };
- } else {
- return super.getCallback(reqData, doAction);
- }
+ protected CallbackHandler getCallback(RequestData reqData, int doAction) throws
WSSecurityException
+ {
+
+ if (supportDigestPasswords)
+ {
+ return new CallbackHandler()
+ {
+ @Override
+ public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException
+ {
+ // dummy handler
+ }
+ };
+ }
+ else
+ {
+ return super.getCallback(reqData, doAction);
+ }
}
-
+
@Override
public Subject createSubject(String name, String password, boolean isDigest, String
nonce, String created)
{
- if (isDigest)
- {
- verifyUsernameToken(nonce, created);
- // It is not possible at the moment to figure out if the digest has been created
- // using the original nonce bytes or the bytes of the (Base64)-encoded nonce, some
- // legacy clients might use the (Base64)-encoded nonce bytes when creating a digest;
- // lets default to true and assume the nonce has been Base-64 encoded, given that
- // WSS4J client Base64-decodes the nonce before creating the digest
-
- CallbackHandler handler = new UsernameTokenCallbackHandler(nonce, created,
decodeNonce);
- CallbackHandlerPolicyContextHandler.setCallbackHandler(handler);
- }
-
- // authenticate and populate Subject
+ if (isDigest)
+ {
+ verifyUsernameToken(nonce, created);
+ // It is not possible at the moment to figure out if the digest has been created
+ // using the original nonce bytes or the bytes of the (Base64)-encoded nonce,
some
+ // legacy clients might use the (Base64)-encoded nonce bytes when creating a
digest;
+ // lets default to true and assume the nonce has been Base-64 encoded, given
that
+ // WSS4J client Base64-decodes the nonce before creating the digest
+
+ CallbackHandler handler = new UsernameTokenCallbackHandler(nonce, created,
decodeNonce);
+ CallbackHandlerPolicyContextHandler.setCallbackHandler(handler);
+ }
+
+ // authenticate and populate Subject
AuthenticationManager am = aml.getManager();
-
+
Principal principal = new SimplePrincipal(name);
Subject subject = new Subject();
@@ -144,34 +154,34 @@
if (TRACE)
log.trace("About to authenticate, using security domain '" +
am.getSecurityDomain() + "'");
- try
+ try
{
- if (am.isValid(principal, password, subject) == false)
- {
- String msg = "Authentication failed, principal=" +
principal.getName();
- log.error(msg);
- throw new SecurityException(msg);
- }
- }
- finally
+ if (am.isValid(principal, password, subject) == false)
+ {
+ String msg = "Authentication failed, principal=" +
principal.getName();
+ log.error(msg);
+ throw new SecurityException(msg);
+ }
+ }
+ finally
{
- if (isDigest)
- {
- // does not remove the TL entry completely but limits the potential
- // growth to a number of available threads in a container
- CallbackHandlerPolicyContextHandler.setCallbackHandler(null);
- }
+ if (isDigest)
+ {
+ // does not remove the TL entry completely but limits the potential
+ // growth to a number of available threads in a container
+ CallbackHandlerPolicyContextHandler.setCallbackHandler(null);
+ }
}
-
+
if (TRACE)
log.trace("Authenticated, principal=" + name);
- if (propagateContext)
+ if (propagateContext)
{
- SecurityAdaptor adaptor = secAdaptorFactory.newSecurityAdapter();
- adaptor.pushSubjectContext(subject, principal, password);
- if (TRACE)
- log.trace("Security Context has been propagated");
+ SecurityAdaptor adaptor = secAdaptorFactory.newSecurityAdapter();
+ adaptor.pushSubjectContext(subject, principal, password);
+ if (TRACE)
+ log.trace("Security Context has been propagated");
}
return subject;
}
@@ -190,25 +200,30 @@
if (nonce != null && nonceStore != null)
{
if (nonceStore.hasNonce(nonce))
- throw new SecurityException("Request rejected since a message with the
same nonce has been recently received; nonce = " + nonce);
+ throw new SecurityException(
+ "Request rejected since a message with the same nonce has been
recently received; nonce = " + nonce);
nonceStore.putNonce(nonce);
}
}
- public void setPropagateContext(boolean propagateContext) {
- this.propagateContext = propagateContext;
+ public void setPropagateContext(boolean propagateContext)
+ {
+ this.propagateContext = propagateContext;
}
-
- public void setTimestampThreshold(int timestampThreshold) {
- this.timestampThreshold = timestampThreshold;
+
+ public void setTimestampThreshold(int timestampThreshold)
+ {
+ this.timestampThreshold = timestampThreshold;
}
- public void setNonceStore(NonceStore nonceStore) {
- this.nonceStore = nonceStore;
+ public void setNonceStore(NonceStore nonceStore)
+ {
+ this.nonceStore = nonceStore;
}
- public void setDecodeNonce(boolean decodeNonce) {
- this.decodeNonce = decodeNonce;
+ public void setDecodeNonce(boolean decodeNonce)
+ {
+ this.decodeNonce = decodeNonce;
}
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/callback/UsernameTokenCallback.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/callback/UsernameTokenCallback.java 2010-07-01
17:14:50 UTC (rev 12564)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/callback/UsernameTokenCallback.java 2010-07-01
17:39:42 UTC (rev 12565)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.jboss.wsf.stack.cxf.security.authentication.callback;
+package org.jboss.wsf.stack.cxf.security.authentication.callback;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
@@ -41,9 +41,11 @@
public class UsernameTokenCallback implements DigestCallback
{
static final String NONCE = "nonce";
+
static final String CREATED = "created";
+
static final String DECODE_NONCE = "decodeNonce";
-
+
private MapCallback info;
@SuppressWarnings("unchecked")
@@ -51,7 +53,8 @@
{
// Ask for MapCallback to obtain the digest parameters
info = new MapCallback();
- Callback[] callbacks = { info };
+ Callback[] callbacks =
+ {info};
options.put("callbacks", callbacks);
}
@@ -59,15 +62,14 @@
{
try
{
- String nonce = (String)info.getInfo(NONCE);
+ String nonce = (String) info.getInfo(NONCE);
if (nonce != null)
{
- Boolean decodeNonce = (Boolean)info.getInfo(DECODE_NONCE);
- byte[] nonceBytes = decodeNonce ? org.jboss.util.Base64.decode(nonce)
- : nonce.getBytes("UTF-8");
+ Boolean decodeNonce = (Boolean) info.getInfo(DECODE_NONCE);
+ byte[] nonceBytes = decodeNonce ? org.jboss.util.Base64.decode(nonce) :
nonce.getBytes("UTF-8");
digest.update(nonceBytes);
}
- String created = (String)info.getInfo(CREATED);
+ String created = (String) info.getInfo(CREATED);
if (created != null)
digest.update(created.getBytes("UTF-8"));
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/callback/UsernameTokenCallbackHandler.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/callback/UsernameTokenCallbackHandler.java 2010-07-01
17:14:50 UTC (rev 12564)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/authentication/callback/UsernameTokenCallbackHandler.java 2010-07-01
17:39:42 UTC (rev 12565)
@@ -40,25 +40,27 @@
public class UsernameTokenCallbackHandler implements CallbackHandler
{
private String nonce;
+
private String created;
+
private boolean decodeNonce;
-
+
public UsernameTokenCallbackHandler(String nonce, String created, boolean
decodeNonce)
{
this.created = created;
this.nonce = nonce;
this.decodeNonce = decodeNonce;
}
-
+
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException
{
boolean foundCallback = false;
Callback firstUnknown = null;
int count = callbacks != null ? callbacks.length : 0;
- for(int n = 0; n < count; n ++)
+ for (int n = 0; n < count; n++)
{
Callback c = callbacks[n];
- if( c instanceof MapCallback )
+ if (c instanceof MapCallback)
{
//set parameters to the MapCallback the UsernameTokenCallback
//created and set up in the init method
@@ -68,13 +70,13 @@
mc.setInfo(UsernameTokenCallback.DECODE_NONCE,
Boolean.valueOf(decodeNonce));
foundCallback = true;
}
- else if( firstUnknown == null )
+ else if (firstUnknown == null)
{
firstUnknown = c;
}
}
- if( foundCallback == false )
- throw new UnsupportedCallbackException(firstUnknown, "Unrecognized
Callback");
+ if (foundCallback == false)
+ throw new UnsupportedCallbackException(firstUnknown, "Unrecognized
Callback");
}
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/nonce/NonceStore.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/nonce/NonceStore.java 2010-07-01
17:14:50 UTC (rev 12564)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/security/nonce/NonceStore.java 2010-07-01
17:39:42 UTC (rev 12565)
@@ -37,7 +37,7 @@
* @return True if the provided nonce has been recently put in the store
*/
public boolean hasNonce(String nonce);
-
+
/**
* Put the given nonce in the store.
*
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java 2010-07-01
17:14:50 UTC (rev 12564)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/transport/ServletHelper.java 2010-07-01
17:39:42 UTC (rev 12565)
@@ -62,8 +62,8 @@
*/
public class ServletHelper
{
- public static final String ENABLE_CXF_MANAGEMENT = "enable.cxf.management";
-
+ public static final String ENABLE_CXF_MANAGEMENT = "enable.cxf.management";
+
public static Endpoint initEndpoint(ServletConfig servletConfig, String servletName)
{
SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
@@ -73,7 +73,7 @@
String contextPath = context.getContextPath();
return initServiceEndpoint(epRegistry, contextPath, servletName);
}
-
+
/** Initialize the service endpoint
*/
private static Endpoint initServiceEndpoint(EndpointRegistry epRegistry, String
contextPath, String servletName)
@@ -95,44 +95,46 @@
if (endpoint == null)
{
- ObjectName oname = ObjectNameFactory.create(Endpoint.SEPID_DOMAIN +
":" + Endpoint.SEPID_PROPERTY_CONTEXT + "=" + contextPath +
","
- + Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName);
+ ObjectName oname = ObjectNameFactory.create(Endpoint.SEPID_DOMAIN +
":" + Endpoint.SEPID_PROPERTY_CONTEXT
+ + "=" + contextPath + "," +
Endpoint.SEPID_PROPERTY_ENDPOINT + "=" + servletName);
throw new WebServiceException("Cannot obtain endpoint for: " +
oname);
}
//Inject the EJB and JNDI resources if possible
injectServiceAndHandlerResources(endpoint);
-
-
+
return endpoint;
}
-
- private static void injectServiceAndHandlerResources(Endpoint endpoint)
+
+ @SuppressWarnings("unchecked")
+ private static void injectServiceAndHandlerResources(Endpoint endpoint)
{
- ServerFactoryBean factory = endpoint.getAttachment(ServerFactoryBean.class);
- if (factory != null)
- {
- InjectionsMetaData metadata = endpoint.getAttachment(InjectionsMetaData.class);
- Context jndiContext = endpoint.getJNDIContext();
- if (DeploymentType.JAXWS_EJB3 != endpoint.getService().getDeployment().getType()
- && factory.getServiceBean() != null)
- {
- InjectionHelper.injectResources(factory.getServiceBean(), metadata,
jndiContext);
- InjectionHelper.callPostConstructMethod(factory.getServiceBean());
- }
- List<Handler> chain =
((JaxWsEndpointImpl)factory.getServer().getEndpoint()).getJaxwsBinding().getHandlerChain();
- if (chain != null)
- {
- for (Handler handler : chain)
- {
- InjectionHelper.injectResources(handler, metadata, jndiContext);
- InjectionHelper.callPostConstructMethod(handler);
- }
- }
- }
+ ServerFactoryBean factory = endpoint.getAttachment(ServerFactoryBean.class);
+ if (factory != null)
+ {
+ InjectionsMetaData metadata = endpoint.getAttachment(InjectionsMetaData.class);
+ Context jndiContext = endpoint.getJNDIContext();
+ if (DeploymentType.JAXWS_EJB3 !=
endpoint.getService().getDeployment().getType()
+ && factory.getServiceBean() != null)
+ {
+ InjectionHelper.injectResources(factory.getServiceBean(), metadata,
jndiContext);
+ InjectionHelper.callPostConstructMethod(factory.getServiceBean());
+ }
+ List<Handler> chain = ((JaxWsEndpointImpl)
factory.getServer().getEndpoint()).getJaxwsBinding()
+ .getHandlerChain();
+ if (chain != null)
+ {
+ for (Handler handler : chain)
+ {
+ InjectionHelper.injectResources(handler, metadata, jndiContext);
+ InjectionHelper.callPostConstructMethod(handler);
+ }
+ }
+ }
}
-
- public static void callRequestHandler(HttpServletRequest req, HttpServletResponse res,
ServletContext ctx, Bus bus, Endpoint endpoint) throws ServletException
+
+ public static void callRequestHandler(HttpServletRequest req, HttpServletResponse res,
ServletContext ctx, Bus bus,
+ Endpoint endpoint) throws ServletException
{
try
{
@@ -143,7 +145,7 @@
//hence the interceptor, can span multiple invocation related to multiple
//endpoints)
EndpointAssociation.setEndpoint(endpoint);
- RequestHandler requestHandler = (RequestHandler)endpoint.getRequestHandler();
+ RequestHandler requestHandler = (RequestHandler) endpoint.getRequestHandler();
requestHandler.handleHttpRequest(endpoint, req, res, ctx);
}
catch (IOException ioe)
@@ -156,11 +158,13 @@
BusFactory.setThreadDefaultBus(null);
}
}
-
+
public static void registerInstrumentManger(Bus bus, ServletContext svCtx) throws
ServletException
{
//TODO!! Jim, remove reflection use inside this by providing proper hook in CXF and
move this configuration to BusHolder
- if (svCtx.getInitParameter(ENABLE_CXF_MANAGEMENT) != null &&
"true".equalsIgnoreCase((String)svCtx.getInitParameter(ENABLE_CXF_MANAGEMENT)))
{
+ if (svCtx.getInitParameter(ENABLE_CXF_MANAGEMENT) != null
+ && "true".equalsIgnoreCase((String)
svCtx.getInitParameter(ENABLE_CXF_MANAGEMENT)))
+ {
InstrumentationManagerExtImpl instrumentationManagerImpl = new
InstrumentationManagerExtImpl();
instrumentationManagerImpl.setBus(bus);
instrumentationManagerImpl.setEnabled(true);
@@ -174,9 +178,11 @@
try
{
- Method method =
CounterRepository.class.getDeclaredMethod("registerInterceptorsToBus", new
Class[] {});
+ Method method =
CounterRepository.class.getDeclaredMethod("registerInterceptorsToBus", new
Class[]
+ {});
method.setAccessible(true);
- method.invoke(couterRepository, new Object[] {});
+ method.invoke(couterRepository, new Object[]
+ {});
}
catch (Exception e)
{