Author: richard.opalka(a)jboss.com
Date: 2009-08-11 07:54:13 -0400 (Tue, 11 Aug 2009)
New Revision: 10517
Added:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptorEJB21.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterFactoryImpl.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java
Removed:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java
container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory
Log:
[JBWS-2332] refactoring + javadoc
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java
===================================================================
---
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java 2009-08-11
09:17:49 UTC (rev 10516)
+++
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/InvocationHandlerEJB21.java 2009-08-11
11:54:13 UTC (rev 10517)
@@ -40,7 +40,7 @@
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.security.SecurityContext;
import org.jboss.security.SecurityContextAssociation;
-import org.jboss.webservices.integration.invocation.ServiceEndpointInterceptor;
+import org.jboss.webservices.integration.invocation.ServiceEndpointInterceptorEJB21;
import org.jboss.wsf.common.ObjectNameFactory;
import org.jboss.wsf.common.integration.WSHelper;
import org.jboss.wsf.spi.SPIProvider;
@@ -174,7 +174,7 @@
if (next.getNext() == null)
{
log.debug("Inject service endpoint interceptor after: " +
prev.getClass().getName());
- ServiceEndpointInterceptor sepInterceptor = new
ServiceEndpointInterceptor();
+ ServiceEndpointInterceptorEJB21 sepInterceptor = new
ServiceEndpointInterceptorEJB21();
prev.setNext(sepInterceptor);
sepInterceptor.setNext(next);
injectionPointFound = true;
Deleted:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java
===================================================================
---
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java 2009-08-11
09:17:49 UTC (rev 10516)
+++
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdapterFactoryImpl.java 2009-08-11
11:54:13 UTC (rev 10517)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * 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.webservices.integration.invocation;
-
-import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
-import org.jboss.wsf.spi.invocation.SecurityAdaptor;
-
-/**
- * Security adapters factory.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
- */
-public final class SecurityAdapterFactoryImpl extends SecurityAdaptorFactory
-{
-
- /**
- * Constructor.
- */
- public SecurityAdapterFactoryImpl()
- {
- super();
- }
-
- /**
- * Creates new security adapter instance.
- *
- * @return security adapter
- */
- public SecurityAdaptor newSecurityAdapter()
- {
- return new SecurityAdaptorImpl();
- }
-
-}
Deleted:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java
===================================================================
---
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java 2009-08-11
09:17:49 UTC (rev 10516)
+++
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/SecurityAdaptorImpl.java 2009-08-11
11:54:13 UTC (rev 10517)
@@ -1,118 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * 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.webservices.integration.invocation;
-
-import java.security.AccessController;
-import java.security.Principal;
-import java.security.PrivilegedAction;
-
-import javax.security.auth.Subject;
-
-import org.jboss.security.SecurityAssociation;
-import org.jboss.security.SecurityContext;
-import org.jboss.security.SecurityContextAssociation;
-import org.jboss.wsf.spi.invocation.SecurityAdaptor;
-
-/**
- * The JBoss AS specific SecurityAssociationAdaptor.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
- */
-final class SecurityAdaptorImpl implements SecurityAdaptor
-{
-
- /**
- * Constructor.
- */
- SecurityAdaptorImpl()
- {
- super();
- }
-
- /**
- * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#getPrincipal()
- *
- * @return principal
- */
- public Principal getPrincipal()
- {
- return SecurityAssociation.getPrincipal();
- }
-
- /**
- * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#setPrincipal(Principal)
- *
- * @param principal principal
- */
- public void setPrincipal(final Principal principal)
- {
- SecurityAssociation.setPrincipal(principal);
- }
-
- /**
- * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#getCredential()
- *
- * @return credential
- */
- public Object getCredential()
- {
- return SecurityAssociation.getCredential();
- }
-
- /**
- * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#setCredential(Object)
- *
- * @param credential credential
- */
- public void setCredential(final Object credential)
- {
- SecurityAssociation.setCredential(credential);
- }
-
- /**
- * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#pushSubjectContext(Subject,
Principal, Object)
- *
- * @param subject subject
- * @param principal principal
- * @param credential credential
- */
- public void pushSubjectContext(final Subject subject, final Principal principal, final
Object credential)
- {
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
-
- public Void run()
- {
- final SecurityContext securityContext =
SecurityContextAssociation.getSecurityContext();
- if (securityContext == null)
- {
- throw new IllegalStateException("Security Context is null");
- }
-
- securityContext.getUtil().createSubjectInfo(principal, credential, subject);
-
- return null;
- }
- });
- }
-
-}
Deleted:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java
===================================================================
---
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java 2009-08-11
09:17:49 UTC (rev 10516)
+++
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptor.java 2009-08-11
11:54:13 UTC (rev 10517)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * 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.webservices.integration.invocation;
-
-import javax.xml.rpc.handler.soap.SOAPMessageContext;
-
-import org.jboss.ejb.plugins.AbstractInterceptor;
-import org.jboss.invocation.InvocationKey;
-import org.jboss.wsf.spi.invocation.HandlerCallback;
-import org.jboss.wsf.spi.invocation.Invocation;
-import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-
-/**
- * This Interceptor does the ws4ee handler processing on EJB 21 endpoints.
- *
- * According to the ws4ee spec the handler logic must be invoked after the container
- * applied method level security to the invocation.
- *
- * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
- * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
- */
-final class ServiceEndpointInterceptor extends AbstractInterceptor
-{
-
- /**
- * Constructor.
- */
- ServiceEndpointInterceptor()
- {
- super();
- }
-
- /**
- * Before and after we call the EJB 21 service endpoint bean, we process the handler
chains.
- *
- * @param jbossInvocation jboss invocation
- * @return ws invocation return value
- * @throws Exception if any error occurs
- */
- public Object invoke(final org.jboss.invocation.Invocation jbossInvocation) throws
Exception
- {
- final SOAPMessageContext msgContext =
(SOAPMessageContext)jbossInvocation.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
- if (msgContext == null)
- {
- // not for us
- return this.getNext().invoke(jbossInvocation);
- }
-
- // Get the endpoint invocation
- final Invocation wsInvocation =
(Invocation)jbossInvocation.getValue(Invocation.class.getName());
-
- // Get the handler callback
- final HandlerCallback callback =
(HandlerCallback)jbossInvocation.getValue(HandlerCallback.class.getName());
-
- // Handlers need to be Tx. Therefore we must invoke the handler chain after the
TransactionInterceptor.
- if (callback != null && wsInvocation != null)
- {
- try
- {
- // call the request handlers
- boolean handlersPass = callback.callRequestHandlerChain(wsInvocation,
HandlerType.ENDPOINT);
- handlersPass = handlersPass &&
callback.callRequestHandlerChain(wsInvocation, HandlerType.POST);
-
- // Call the next interceptor in the chain
- if (handlersPass)
- {
- // The SOAPContentElements stored in the EndpointInvocation might have
changed after
- // handler processing. Get the updated request payload. This should be a
noop if request
- // handlers did not modify the incomming SOAP message.
- final Object[] reqParams = wsInvocation.getArgs();
- jbossInvocation.setArguments(reqParams);
- final Object resObj = this.getNext().invoke(jbossInvocation);
-
- // Setting the message to null should trigger binding of the response
message
- msgContext.setMessage(null);
- wsInvocation.setReturnValue(resObj);
- }
-
- // call the response handlers
- handlersPass = callback.callResponseHandlerChain(wsInvocation,
HandlerType.POST);
- handlersPass = handlersPass &&
callback.callResponseHandlerChain(wsInvocation, HandlerType.ENDPOINT);
-
- // update the return value after response handler processing
- return wsInvocation.getReturnValue();
- }
- catch (Exception ex)
- {
- try
- {
- // call the fault handlers
- boolean handlersPass = callback.callFaultHandlerChain(wsInvocation,
HandlerType.POST, ex);
- handlersPass = handlersPass &&
callback.callFaultHandlerChain(wsInvocation, HandlerType.ENDPOINT, ex);
- }
- catch (Exception subEx)
- {
- log.warn("Cannot process handlerChain.handleFault, ignoring: ",
subEx);
- }
- throw ex;
- }
- }
- else
- {
- log.warn("Handler callback not available");
- return this.getNext().invoke(jbossInvocation);
- }
- }
-}
Added:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptorEJB21.java
===================================================================
---
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptorEJB21.java
(rev 0)
+++
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/invocation/ServiceEndpointInterceptorEJB21.java 2009-08-11
11:54:13 UTC (rev 10517)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * 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.webservices.integration.invocation;
+
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+
+import org.jboss.ejb.plugins.AbstractInterceptor;
+import org.jboss.invocation.InvocationKey;
+import org.jboss.wsf.spi.invocation.HandlerCallback;
+import org.jboss.wsf.spi.invocation.Invocation;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
+
+/**
+ * This Interceptor does the ws4ee handler processing on EJB 21 endpoints.
+ *
+ * According to the ws4ee spec the handler logic must be invoked after the container
+ * applied method level security to the invocation.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+final class ServiceEndpointInterceptorEJB21 extends AbstractInterceptor
+{
+
+ /**
+ * Constructor.
+ */
+ ServiceEndpointInterceptorEJB21()
+ {
+ super();
+ }
+
+ /**
+ * Before and after we call the EJB 21 service endpoint bean, we process the handler
chains.
+ *
+ * @param jbossInvocation jboss invocation
+ * @return ws invocation return value
+ * @throws Exception if any error occurs
+ */
+ public Object invoke(final org.jboss.invocation.Invocation jbossInvocation) throws
Exception
+ {
+ final SOAPMessageContext msgContext =
(SOAPMessageContext)jbossInvocation.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
+ if (msgContext == null)
+ {
+ // not for us
+ return this.getNext().invoke(jbossInvocation);
+ }
+
+ final Invocation wsInvocation =
(Invocation)jbossInvocation.getValue(Invocation.class.getName());
+ final HandlerCallback callback =
(HandlerCallback)jbossInvocation.getValue(HandlerCallback.class.getName());
+
+ if (callback == null || wsInvocation == null)
+ {
+ log.warn("Handler callback not available");
+ return this.getNext().invoke(jbossInvocation);
+ }
+
+ // Handlers need to be Tx. Therefore we must invoke the handler chain after the
TransactionInterceptor.
+ try
+ {
+ // call the request handlers
+ boolean handlersPass = callback.callRequestHandlerChain(wsInvocation,
HandlerType.ENDPOINT);
+ handlersPass = handlersPass &&
callback.callRequestHandlerChain(wsInvocation, HandlerType.POST);
+
+ // Call the next interceptor in the chain
+ if (handlersPass)
+ {
+ // The SOAPContentElements stored in the EndpointInvocation might have
changed after
+ // handler processing. Get the updated request payload. This should be a noop
if request
+ // handlers did not modify the incomming SOAP message.
+ final Object[] reqParams = wsInvocation.getArgs();
+ jbossInvocation.setArguments(reqParams);
+ final Object resObj = this.getNext().invoke(jbossInvocation);
+
+ // Setting the message to null should trigger binding of the response
message
+ msgContext.setMessage(null);
+ wsInvocation.setReturnValue(resObj);
+ }
+
+ // call the response handlers
+ handlersPass = callback.callResponseHandlerChain(wsInvocation,
HandlerType.POST);
+ handlersPass = handlersPass &&
callback.callResponseHandlerChain(wsInvocation, HandlerType.ENDPOINT);
+
+ // update the return value after response handler processing
+ return wsInvocation.getReturnValue();
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ // call the fault handlers
+ boolean handlersPass = callback.callFaultHandlerChain(wsInvocation,
HandlerType.POST, ex);
+ handlersPass = handlersPass &&
callback.callFaultHandlerChain(wsInvocation, HandlerType.ENDPOINT, ex);
+ }
+ catch (Exception e)
+ {
+ log.warn("Cannot process handlerChain.handleFault, ignoring: ",
e);
+ }
+ throw ex;
+ }
+ }
+
+}
Added:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterFactoryImpl.java
===================================================================
---
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterFactoryImpl.java
(rev 0)
+++
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterFactoryImpl.java 2009-08-11
11:54:13 UTC (rev 10517)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * 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.webservices.integration.security;
+
+import org.jboss.wsf.spi.invocation.SecurityAdaptor;
+import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
+
+/**
+ * Security adapters factory.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+public final class SecurityAdapterFactoryImpl extends SecurityAdaptorFactory
+{
+
+ /**
+ * Constructor.
+ */
+ public SecurityAdapterFactoryImpl()
+ {
+ super();
+ }
+
+ /**
+ * Creates new security adapter instance.
+ *
+ * @return security adapter
+ */
+ public SecurityAdaptor newSecurityAdapter()
+ {
+ return new SecurityAdapterImpl();
+ }
+
+}
Added:
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java
===================================================================
---
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java
(rev 0)
+++
container/jboss50/branches/ropalka-jboss510/src/main/java/org/jboss/webservices/integration/security/SecurityAdapterImpl.java 2009-08-11
11:54:13 UTC (rev 10517)
@@ -0,0 +1,118 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * 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.webservices.integration.security;
+
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedAction;
+
+import javax.security.auth.Subject;
+
+import org.jboss.security.SecurityAssociation;
+import org.jboss.security.SecurityContext;
+import org.jboss.security.SecurityContextAssociation;
+import org.jboss.wsf.spi.invocation.SecurityAdaptor;
+
+/**
+ * The JBoss AS specific SecurityAssociation adapter.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ * @author <a href="mailto:tdiesler@redhat.com">Thomas Diesler</a>
+ */
+final class SecurityAdapterImpl implements SecurityAdaptor
+{
+
+ /**
+ * Constructor.
+ */
+ SecurityAdapterImpl()
+ {
+ super();
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#getPrincipal()
+ *
+ * @return principal
+ */
+ public Principal getPrincipal()
+ {
+ return SecurityAssociation.getPrincipal();
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#setPrincipal(Principal)
+ *
+ * @param principal principal
+ */
+ public void setPrincipal(final Principal principal)
+ {
+ SecurityAssociation.setPrincipal(principal);
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#getCredential()
+ *
+ * @return credential
+ */
+ public Object getCredential()
+ {
+ return SecurityAssociation.getCredential();
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#setCredential(Object)
+ *
+ * @param credential credential
+ */
+ public void setCredential(final Object credential)
+ {
+ SecurityAssociation.setCredential(credential);
+ }
+
+ /**
+ * @see org.jboss.wsf.spi.invocation.SecurityAdaptor#pushSubjectContext(Subject,
Principal, Object)
+ *
+ * @param subject subject
+ * @param principal principal
+ * @param credential credential
+ */
+ public void pushSubjectContext(final Subject subject, final Principal principal, final
Object credential)
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+
+ public Void run()
+ {
+ final SecurityContext securityContext =
SecurityContextAssociation.getSecurityContext();
+ if (securityContext == null)
+ {
+ throw new IllegalStateException("Security Context is null");
+ }
+
+ securityContext.getUtil().createSubjectInfo(principal, credential, subject);
+
+ return null;
+ }
+ });
+ }
+
+}
Modified:
container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory
===================================================================
---
container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory 2009-08-11
09:17:49 UTC (rev 10516)
+++
container/jboss50/branches/ropalka-jboss510/src/main/resources/jbossws-jboss.jar/META-INF/services/org.jboss.wsf.spi.invocation.SecurityAdaptorFactory 2009-08-11
11:54:13 UTC (rev 10517)
@@ -1 +1 @@
-org.jboss.webservices.integration.invocation.SecurityAdapterFactoryImpl
\ No newline at end of file
+org.jboss.webservices.integration.security.SecurityAdapterFactoryImpl
\ No newline at end of file