On Jun 30, 2008, at 5:04 AM, Selena85 wrote:


Hello I'm newbie in CXF and Spring. My task is to prepear user
authenthication and to log user activities. Now I've got user
authenthication using WSS4JInInterceptor and callback - and it's work fine. My problem is, how to pass authentication data (username) to the endpoint implementor class (translatorServiceImpl). Is there any way to do this using
Spring (set a property in class translatorServiceImpl)?

No, because there is a single instance of the Impl created and is used during all invocations. The way this is done is to add:

@Resource
WebServiceContext ctx;

To your Impl and the context should get injected. From the context (which is thread local), you can query any items that are stored in the Message object in your interceptor.

Dan




<!-- Service endpoint -->
   <jaxws:endpoint id="translatorService"
       implementor="#translatorServiceImpl" address="/translation">
       <jaxws:serviceFactory>
           <ref bean="jaxws-and-aegis-service-factory" />
       </jaxws:serviceFactory>
       <jaxws:inInterceptors>
           <bean
class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
               <constructor-arg>
                   <map>
                       <entry key="action" value="UsernameToken" />
<entry key="passwordType" value="PasswordText" />
                       <entry key="passwordCallbackClass"

value="pl.waga.service.ServerAuthorizationCallback" />
                   </map>
               </constructor-arg>
           </bean>
       </jaxws:inInterceptors>
   </jaxws:endpoint>

--
View this message in context: 
http://www.nabble.com/SOAP-Header-tp18191401p18191401.html
Sent from the cxf-user mailing list archive at Nabble.com.


---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog




Reply via email to