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

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

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

                <bean id="authenticationProcessingFilter"
            class="com.pixel.hibernate.HomeAloneAuthenticationProcessingFilter">
            <property name="authenticationManager">
                <ref bean="authenticationManager" />
            </property>
            <property name="authenticationFailureUrl">
                <value>/back/login.jsp?login_error=1</value>
            </property>
            <property name="defaultTargetUrl">
                <value>/</value>
            </property>
            <property name="filterProcessesUrl">
                <value>/j_acegi_security_check</value>
            </property>
            <property name="exceptionMappings">
        <props>
         <prop key="com.eshore.util.ValidaAuthenticationException">
          /back/login.jsp?login_error=1
         </prop>
        </props>
       </property>
        </bean>



    package com.pixel.hibernate;

    import java.io.IOException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.acegisecurity.Authentication;
    import org.acegisecurity.AuthenticationException;
    import org.acegisecurity.ui.webapp.AuthenticationProcessingFilter;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;


    public class HomeAloneAuthenticationProcessingFilter extends
       AuthenticationProcessingFilter {
    private static final Log logger = LogFactory
        .getLog(HomeAloneAuthenticationProcessingFilter.class);

    @Override
    protected void onSuccessfulAuthentication(
        HttpServletRequest arg0, HttpServletResponse arg1,
        Authentication arg2) throws IOException {
       logger.info("login successful:"
         + arg0.getParameter("j_username"));
       arg0.getSession().setAttribute("userName",
         arg0.getParameter("j_username"));
       super.onSuccessfulAuthentication(arg0, arg1, arg2);
    }

    @Override
    protected void onPreAuthentication(HttpServletRequest arg0,
        HttpServletResponse arg1) throws AuthenticationException,
        IOException {
       // 驗證碼驗證
       String randomCode1 = (String) arg0.getSession().getAttribute(
         "rand");
       String randomCode2 = (String) arg0.getParameter("rand");
       if (!randomCode2.equals(randomCode1)) {
        throw new ValidaAuthenticationException(
          "valida code error");
       }
       super.onPreAuthentication(arg0, arg1);
    }
    }

    class ValidaAuthenticationException extends AuthenticationException {
    /**
    *
    */
    private static final long serialVersionUID = -8369047599309913998L;

    public ValidaAuthenticationException(String arg0) {
       super(arg0);
    }
    }


    posted on 2008-07-28 12:11 lzj520 閱讀(430) 評論(0)  編輯  收藏 所屬分類: Spring個人學習日記
    主站蜘蛛池模板: 女人体1963午夜免费视频| 成在线人直播免费视频| 99精品视频在线观看免费播放| 久久亚洲av无码精品浪潮| 免费精品视频在线| 国产偷国产偷亚洲高清日韩| 高清永久免费观看 | 亚洲国产精品专区在线观看| 在线观看亚洲精品专区| 免费人妻无码不卡中文字幕18禁| 人人狠狠综合久久亚洲| 国产乱子影视频上线免费观看| 日本亚洲高清乱码中文在线观看| 免费va在线观看| 国产精品免费在线播放| 久久精品国产亚洲AV网站| 日本视频一区在线观看免费| 最新国产成人亚洲精品影院| 免费特级黄毛片在线成人观看| 免费国产在线精品一区| 亚洲精品成人网站在线观看| 18女人腿打开无遮掩免费| 四虎亚洲精品高清在线观看| 免费国产在线观看老王影院| 精品免费tv久久久久久久| 亚洲三级中文字幕| 亚洲Aⅴ无码一区二区二三区软件 亚洲AⅤ视频一区二区三区 | 免费一级做a爰片久久毛片潮| 中文字幕亚洲一区二区va在线| 久久国产精品国产自线拍免费| 亚洲精品免费在线| 日韩免费电影在线观看| 中文字幕在线视频免费| 91亚洲精品自在在线观看| 亚洲精品国自产拍在线观看| 日韩在线不卡免费视频一区| 亚洲国产精品无码久久久秋霞1| 亚洲一级特黄大片在线观看| 嫖丰满老熟妇AAAA片免费看| 国产乱妇高清无乱码免费| 亚洲一区无码中文字幕乱码|