<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 閱讀(431) 評論(0)  編輯  收藏 所屬分類: Spring個人學習日記
    主站蜘蛛池模板: 国产天堂亚洲国产碰碰| 亚洲最大成人网色香蕉| 一个人免费播放在线视频看片| 午夜时刻免费入口| 久久亚洲国产成人影院| 午夜老司机免费视频| 亚洲成在人线在线播放无码| 在线精品免费视频无码的| 亚洲精华国产精华精华液| 免费爱爱的视频太爽了| 青青青亚洲精品国产| 亚洲国产品综合人成综合网站| 3d成人免费动漫在线观看| 国产美女在线精品免费观看| 99热亚洲色精品国产88| 免费毛片在线看片免费丝瓜视频| 国产亚洲精品VA片在线播放| 午夜网站免费版在线观看| 美女被羞羞网站免费下载| 中文字幕中韩乱码亚洲大片 | 亚洲精品不卡视频| 亚洲高清免费在线观看| 2017亚洲男人天堂一| 国产精品国产免费无码专区不卡| 免费无码午夜福利片69| 国产亚洲精品资源在线26u| 最近中文字幕大全中文字幕免费| 亚洲人成片在线观看| 日本牲交大片免费观看| 中国国语毛片免费观看视频| 久久丫精品国产亚洲av不卡| 免费无码精品黄AV电影| 国产日韩AV免费无码一区二区三区| 亚洲AV无码久久精品狠狠爱浪潮| 97免费人妻无码视频| 免费夜色污私人影院网站电影| 亚洲永久精品ww47| 青青草免费在线视频| a在线视频免费观看在线视频三区 a毛片成人免费全部播放 | 激情五月亚洲色图| 久久精品国产亚洲Aⅴ香蕉|