<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Vikings

    實施WebService Security[WS-Security1.0]的Encrypt和Sign模式(XFire+WSS4J)

    轉自:
    http://www.tkk7.com/security/archive/2006/08/08/xfire_wss4j.html

    thanks for springside

    鑒于很多系統需要實施WS-Security的標準,我們在SpringSide中提供了XFire+WSS4J的Demo,本文介紹SpringSide中Spring+XFire+WSS4J的基本配置

    [WebService Server端配置]
    第一,創建一個基本的BookService
    public interface BookService {
        
    /** *//**
         * 按書名模糊查詢圖書
         
    */

        List findBooksByName(String name);

        
    /** *//**
         * 查找目錄下的所有圖書
         *
         * 
    @param categoryId 如果category為null或“all”, 列出所有圖書。
         
    */

        List findBooksByCategory(String categoryId);

        
    /** *//**
         * 列出所有分類.
         *
         * 
    @return List<Category>,或是null。
         
    */

        List getAllCategorys();
    }
    第二,接口擴展,即Extend基本的BookService,在XFire中,不同的WSS4J策略需要針對不同的ServiceClass,否則<inHandlers>里面的定義會Overlap。


       <!--BookService 基類-->
        
    <bean id="baseWebService" class="org.codehaus.xfire.spring.remoting.XFireExporter" abstract="true">
            
    <property name="serviceFactory" ref="xfire.serviceFactory"/>
            
    <property name="xfire" ref="xfire"/>
        
    </bean>

        
    <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
            
    <property name="mappings">
                
    <value>
                    /BookService=bookService
                    /BookServiceWSS4J=bookServiceWSS4J
                    /BookServiceWSS4JEnc=bookServiceWSS4JEnc
                    /BookServiceWSS4JSign=bookServiceWSS4JSign
                
    </value>
            
    </property>
        
    </bean>

       
    <!--(1)BookWebService 不需要認證-->
        
    <bean id="bookService" class="org.codehaus.xfire.spring.remoting.XFireExporter">
            
    <property name="serviceFactory" ref="xfire.serviceFactory"/>
            
    <property name="xfire" ref="xfire"/>
            
    <property name="serviceBean" ref="bookManager"/>
            
    <property name="serviceClass" value="org.springside.bookstore.plugins.xfire.service.BookService"/>
        
    </bean>

        
    <!--  (3)BookWebService 使用 WSS4J驗證-->
        
    <bean id="bookServiceWSS4J" class="org.codehaus.xfire.spring.remoting.XFireExporter">
            
    <property name="serviceBean" ref="bookManager"/>
            
    <property name="serviceClass" value="org.springside.bookstore.plugins.xfire.service.BookServiceWSS4J"/>
            
    <property name="inHandlers">
                
    <list>
                    
    <ref bean="domInHandler"/>
                    
    <ref bean="wss4jInHandler"/>
                    
    <ref bean="validateUserTokenHandler"/>
                
    </list>
            
    </property>
        
    </bean>

        
    <bean id="domInHandler" class="org.codehaus.xfire.util.dom.DOMInHandler"/>

        
    <bean id="wss4jInHandler" class="org.codehaus.xfire.security.wss4j.WSS4JInHandler">
            
    <property name="properties">
                
    <props>
                    
    <prop key="action">UsernameToken</prop>
                    
    <prop key="passwordCallbackClass">org.springside.bookstore.plugins.xfire.wss4j.PasswordHandler</prop>
                
    </props>
            
    </property>
        
    </bean>

        
    <bean id="validateUserTokenHandler" class="org.springside.bookstore.plugins.xfire.wss4j.WSS4JTokenHandler"/>
        
        
    <!--  (4)BookWebService 使用 WSS4J驗證 Encrypt模式-->
        
    <bean id="bookServiceWSS4JEnc" class="org.codehaus.xfire.spring.remoting.XFireExporter">
            
    <property name="serviceBean" ref="bookManager"/>
            
    <property name="serviceClass" value="org.springside.bookstore.plugins.xfire.service.BookServiceWSS4JEnc"/>
            
    <property name="inHandlers">
                
    <list>
                    
    <ref bean="domInHandler"/>
                    
    <ref bean="wss4jInHandlerEnc"/>
                    
    <ref bean="validateUserTokenHandler"/>
                
    </list>
            
    </property>
        
    </bean>
            
        
    <bean id="wss4jInHandlerEnc" class="org.codehaus.xfire.security.wss4j.WSS4JInHandler">
            
    <property name="properties">
              
    <props>
                
    <prop key="action">Encrypt</prop>
                
    <prop key="decryptionPropFile">org/springside/bookstore/plugins/xfire/wss4j/insecurity_enc.properties</prop>
                
    <prop key="passwordCallbackClass">org.springside.bookstore.plugins.xfire.wss4j.PasswordHandler</prop>
              
    </props>
            
    </property>
        
    </bean>
        
        
    <!--  (5)BookWebService 使用 WSS4J驗證 Signature模式-->
        
    <bean id="bookServiceWSS4JSign" class="org.codehaus.xfire.spring.remoting.XFireExporter">
            
    <property name="serviceBean" ref="bookManager"/>
            
    <property name="serviceClass" value="org.springside.bookstore.plugins.xfire.service.BookServiceWSS4JSign"/>
            
    <property name="inHandlers">
                
    <list>
                    
    <ref bean="domInHandler"/>
                    
    <ref bean="wss4jInHandlerSign"/>
                    
    <ref bean="validateUserTokenHandler"/>
                
    </list>
            
    </property>
        
    </bean>
        
        
    <bean id="wss4jInHandlerSign" class="org.codehaus.xfire.security.wss4j.WSS4JInHandler">
            
    <property name="properties">
              
    <props>
                
    <prop key="action">Signature</prop>
                
    <prop key="signaturePropFile">org/springside/bookstore/plugins/xfire/wss4j/insecurity_sign.properties</prop>
                
    <prop key="passwordCallbackClass">org.springside.bookstore.plugins.xfire.wss4j.PasswordHandler</prop>
              
    </props>
            
    </property>
        
    </bean>
        
    </beans>

    posted on 2008-10-29 01:55 Vikings 閱讀(379) 評論(0)  編輯  收藏


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 日本成人在线免费观看| 国产精品成人免费一区二区| 亚洲精品成人片在线观看| 久久精品国产亚洲av品善| 国产一级淫片免费播放电影| 亚洲av永久中文无码精品综合| 免费黄色毛片视频| 亚洲欧美成人综合久久久| 免费毛片在线视频| 搜日本一区二区三区免费高清视频 | 亚洲av无码一区二区三区不卡| 免费无码一区二区三区蜜桃| 亚洲国产成人久久精品影视| 8888四色奇米在线观看免费看| 亚洲av无码一区二区三区观看| 成人免费视频小说| 污网站在线观看免费| 亚洲最大激情中文字幕| 99视频免费播放| 亚洲中文字幕久久精品蜜桃| 国产一区二区视频免费| 国产一级一毛免费黄片| 91大神亚洲影视在线| 日韩一级免费视频| 久久久精品国产亚洲成人满18免费网站 | 日本免费电影一区二区| 色偷偷亚洲女人天堂观看欧| 国产成人无码区免费A∨视频网站| 一区视频免费观看| 亚洲欧洲久久精品| 亚洲精品国产高清不卡在线| 亚洲视频在线观看免费| www亚洲精品久久久乳| 亚洲AV无码1区2区久久| 午夜神器成在线人成在线人免费 | 永久在线观看免费视频| 中文字幕乱码亚洲精品一区 | 亚洲最大成人网色香蕉| 亚洲人成影院在线观看| jjizz全部免费看片| 四虎影视在线看免费观看 |