`
srj2903
  • 浏览: 108403 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

acegi 源码学习之用户登录篇

阅读更多

一、查看 applicationContext-acegi-security.xml 配置文件,涉及到登录的配置为:

 1

< bean id = "authenticationProcessingFilter" class = "org.javajohn.test.plugins.security.UserAuthenticationProcessingFilter" >

        < property name = "authenticationManager" ref = "authenticationManager" />

        < property name = "authenticationFailureUrl" >

            < value > /login.jsp?login_error=1 </ value >

        </ property >

        < property name = "defaultTargetUrl" >

            < value > /index.jsp </ value >

        </ property >

        < property name = "filterProcessesUrl" >

            < value > /j_acegi_security_check </ value >

        </ property >

        < property name = "userManager" ref = "userManager" />

        < property name = "rememberMeServices" ref = "rememberMeServices" />

        < property name = "exceptionMappings" >

            < value >

                org.acegisecurity.AuthenticationException=/login.jsp?login_error=user_psw_error

                org.acegisecurity.concurrent.ConcurrentLoginException=/login.jsp?login_error=too_many_user_error

             </ value >

        </ property >

</ bean >

 

 

2 < bean id = "authenticationManager"

       class = "org.acegisecurity.providers.ProviderManager" >

       < property name = "providers" >

           < list >

              < ref local = "daoAuthenticationProvider" />

              < bean class = "org.acegisecurity.providers.anonymous.AnonymousAuthenticationProvider" >

                  < property name = "key" value = "javajohnKey" />

              </ bean >

              < bean class = "org.acegisecurity.providers.rememberme.RememberMeAuthenticationProvider" >

                  < property name = "key" value = "javajohnKey" />

              </ bean >

           </ list >

       </ property >   

    </ bean >

 

3

< bean id = "daoAuthenticationProvider" class = "org.acegisecurity.providers.dao.DaoAuthenticationProvider" >

       < property name = "userDetailsService" ref = "jdbcDaoImpl" />

       < property name = "userCache" >

           < bean class = "org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache" >

              < property name = "cache" >

                  < bean class = "org.springframework.cache.ehcache.EhCacheFactoryBean" >

                     < property name = "cacheManager" >

                         < bean class = "org.springframework.cache.ehcache.EhCacheManagerFactoryBean" />

                     </ property >

                     < property name = "cacheName" value = "userCache" />

                  </ bean >

              </ property >

           </ bean >

       </ property >

       < property name = "passwordEncoder" ref = "passwordEncoder" />

    </ bean >

 

 

4 < bean id = "jdbcDaoImpl"

          class = "org.acegisecurity.userdetails.jdbc.JdbcDaoImpl" >

        < property name = "dataSource" ref = "dataSource" />

        < property name = "usersByUsernameQuery" >

            < value >

                select loginid,passwd,1 from users where status='1' and loginid = ?

            </ value >

        </ property >

        < property name = "authoritiesByUsernameQuery" >

            < value >

                select u.loginid,p.name from

                users u,roles r,permissions p,user_role ur,role_permis rp

                where

                u.id=ur.user_id and <span style=

分享到:
评论

相关推荐

    Acegi(四):Acegi初体验及初解剖

    博主可能演示了如何创建一个登录页面,配置Acegi来处理用户提交的凭证,并与数据库或其他身份验证源进行交互验证用户身份。 授权方面,Acegi允许我们为不同的URL、方法或整个控制器定义访问规则。这可以通过定义...

    springside 玩转acegi

    综上所述,"springside 玩转acegi"的主题涵盖了Acegi安全框架的实战应用,特别是`AuthenticationProcessingFilter`在身份验证流程中的角色,以及如何通过源码学习和定制安全功能。通过深入研究,开发者可以更好地...

    使用 Acegi 保护 Java 应用程序: 续二

    6. **源码分析**:由于标签中有“源码”一词,博文可能深入讲解了 Acegi 源码的某个部分,帮助读者理解其内部工作原理,或者展示了如何根据需求自定义 Acegi 组件。 7. **工具使用**:标签中的“工具”可能指的是 ...

    使用 Acegi 保护 Java 应用程序: 续一

    Acegi 提供了一种灵活且强大的方式来管理用户权限、会话、登录和授权等安全相关任务。 本篇文章是“使用 Acegi 保护 Java 应用程序”系列的续篇,旨在深入探讨 Acegi 的使用方法。在前一篇文章中,我们可能已经介绍...

    菜鸟-手把手教你把Acegi应用到实际项目中(3)

    在“菜鸟-手把手教你把Acegi应用到实际项目中(3)”这篇博文中,博主可能会深入讲解如何将 Acegi 集成到实际的项目中,为读者提供一个逐步的指南。下面,我们将探讨 Acegi 的核心概念、配置以及在项目中的应用。 1. ...

    http://www.blogjava.net/youlq/archive/2005/12/06/22678.html

    结合标签“源码”和“工具”,我们可以推测这篇文章主要探讨的是如何通过Acegi安全框架来增强Spring Web应用程序的安全性,并可能涉及到源代码级别的解析和实践操作。 Acegi是Spring Security的前身,它是一个为...

Global site tag (gtag.js) - Google Analytics