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

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

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

    ksafe's Blog

    年輕人就得勤快點。。。

    BlogJava 聯系 聚合 管理
      1 Posts :: 0 Stories :: 1 Comments :: 0 Trackbacks
    <? xml?version="1.0"?encoding="UTF-8" ?>
    < web-app? xmlns ="http://java.sun.com/xml/ns/j2ee"
    ????xmlns:xsi
    ="http://www.w3.org/2001/XMLSchema-instance" ?version ="2.4"
    ????xsi:schemaLocation
    ="http://java.sun.com/xml/ns/j2ee???http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >
    ????
    < servlet >
    ????????
    < display-name > XFire?Servlet </ display-name >
    ????????
    < servlet-name > XFireServlet </ servlet-name >
    ????????
    < servlet-class >
    ????????????org.codehaus.xfire.transport.http.XFireConfigurableServlet
    ????????
    </ servlet-class >
    ????
    </ servlet >

    ????
    < servlet-mapping >
    ????????
    < servlet-name > XFireServlet </ servlet-name >
    ????????
    < url-pattern > /servlet/XFireServlet/* </ url-pattern >
    ????
    </ servlet-mapping >

    ????
    < servlet-mapping >
    ????????
    < servlet-name > XFireServlet </ servlet-name >
    ????????
    < url-pattern > /services/* </ url-pattern >
    ????
    </ servlet-mapping >
    </ web-app >
    < beans? xmlns ="http://xfire.codehaus.org/config/1.0" >
    < service >
    < name > EchoService </ name >
    < serviceClass > com.hhy.dss.ws.Echo </ serviceClass >
    < serviceFactory > jsr181 </ serviceFactory >
    < inHandlers >
    < handler? handlerClass ="com.hhy.dss.ws.AuthenticationHandler" ></ handler >
    </ inHandlers >
    </ service >
    </ beans >
    package ?com.hhy.dss.ws;

    import ?javax.jws.WebMethod;
    import ?javax.jws.WebService;

    @WebService
    public ? class ?Echo
    {
    ????@WebMethod
    ????
    public ?String?echo(String?in)
    ????
    {
    ????????
    return ?in;
    ????}


    }
    package ?com.hhy.dss.ws;

    import ?org.apache.log4j.Logger;
    import ?org.codehaus.xfire.MessageContext;
    import ?org.codehaus.xfire.exchange.InMessage;
    import ?org.codehaus.xfire.fault.XFireFault;
    import ?org.codehaus.xfire.handler.AbstractHandler;
    import ?org.jdom.Element;

    public ? class ?AuthenticationHandler? extends ?AbstractHandler? {
    ????
    private ? static ? final ?Logger?log? = ?Logger
    ????????????.getLogger(AuthenticationHandler.
    class );

    ????
    public ? void ?invoke(MessageContext?context)? throws ?Exception? {

    ????????log.info(
    " #AuthenticationHandler?is?invoked " );
    ????????InMessage?message?
    = ?context.getInMessage();

    ????????
    if ?(message.getHeader()? == ? null )? {
    ????????????
    throw ? new ?XFireFault( " GetRelation?Service?Should?be?Authenticated " ,
    ????????????????????XFireFault.SENDER);
    ????????}


    ????????Element?token?
    = ?message.getHeader().getChild( " AuthenticationToken " );
    ????????
    if ?(token? == ? null )? {
    ????????????
    throw ? new ?XFireFault( " Request?must?include?authentication?token. " ,
    ????????????????????XFireFault.SENDER);
    ????????}


    ????????String?username?
    = ?token.getChild( " Username " ).getValue();
    ????????String?password?
    = ?token.getChild( " Password " ).getValue();

    ????????System.out.println(
    " username= " ? + ?username);
    ????????System.out.println(
    " password= " ? + ?password);

    ????????
    if ?(username? == ? null ? || ?password? == ? null )
    ????????????
    throw ? new ?XFireFault( " Supplied?Username?and?Password?Please " ,
    ????????????????????XFireFault.SENDER);

    ????????
    /**
    ?????????*?檢查用戶名密碼是否正確
    ?????????
    */

    ????????
    if ?( ! username.equals( " ksafe " )? || ? ! password.equals( " killer " ))
    ????????????
    throw ? new ?XFireFault(
    ????????????????????
    " Authentication?Fail!?Check?username/password " ,
    ????????????????????XFireFault.SENDER);

    ????}

    }

    posted on 2006-08-14 02:05 ksafe 閱讀(3947) 評論(1)  編輯  收藏 所屬分類: JavaEclipseWeb Service

    Feedback

    # re: 用Soap Header在Xfire中實現安全驗證(實例代碼)[未登錄] 2007-05-17 09:26 xxy
    后面還有那?麻煩也貼出來吧  回復  更多評論
      


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


    網站導航:
     
    主站蜘蛛池模板: 久久久久亚洲AV无码永不| 久久久久免费看成人影片| 中文字幕在线免费看线人| 亚洲一区二区免费视频| 亚洲尹人九九大色香蕉网站| 爱爱帝国亚洲一区二区三区| 国产精品国产免费无码专区不卡| 亚洲乱码无码永久不卡在线| 日韩精品无码免费专区午夜不卡| 欧美大尺寸SUV免费| 欧洲亚洲国产清在高| 曰批全过程免费视频在线观看无码 | 国产卡二卡三卡四卡免费网址| 日本视频免费在线| 久久亚洲精品人成综合网| 最近免费中文字幕高清大全| 亚洲成A∨人片天堂网无码| 免费一级毛片在线播放视频免费观看永久| 色猫咪免费人成网站在线观看| 又粗又大又硬又爽的免费视频 | 久久国产精品成人免费| 亚洲日本一区二区| 精品国产污污免费网站入口在线 | 亚洲毛片在线观看| 无人在线观看完整免费版视频| 久久久久亚洲AV片无码| 羞羞视频免费网站日本| 亚洲va久久久噜噜噜久久| 亚洲人成免费电影| 亚洲第一成年免费网站| 亚洲色中文字幕无码AV| 特级av毛片免费观看| 亚洲va无码手机在线电影| 日本一区二区三区免费高清| 成年免费a级毛片| 自怕偷自怕亚洲精品| 免费a级黄色毛片| 性xxxx视频免费播放直播| 久久亚洲色WWW成人欧美| 亚洲AV无码专区电影在线观看| 在线免费播放一级毛片|