• 如何定制Acegi验证框架的验证错误信息


    • 编写资源文件,Acegi的DaoAuthenticationProvider使用了如下的资源Key
    AbstractUserDetailsAuthenticationProvider.badCredentials=自定消息
    AbstractUserDetailsAuthenticationProvider.onlySupports
    =自定消息
    AbstractUserDetailsAuthenticationProvider.locked
    =自定消息 account was locked
    AbstractUserDetailsAuthenticationProvider.disabled
    =自定消息account was disabled
    AbstractUserDetailsAuthenticationProvider.expired
    =自定消息
    AbstractUserDetailsAuthenticationProvider.credentialsExpired
    =自定消息

    • 定义资源Bean
        <bean id="messageSource"
            class
    ="org.springframework.context.support.ResourceBundleMessageSource">
        
    <property name="basename">
                
    <value>资源文件(包名+资源文件名)</value>
            
    </property>
        
    </bean>

    • 将资源Bean注入到DaoAuthenticationProvider
    1    <bean id="daoAuthenticationProvider"
    2        class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
    3        <property name="userDetailsService">
    4            <ref local="inMemoryDaoImpl" />
    5        </property>
    6        <property name="messageSource">
    7            <ref bean="messageSource" />
    8        </property>
    9    </bean>



  • 相关阅读:
    Hadoop综合大作业
    hive基本操作与应用
    理解MapReduce计算构架
    熟悉HBase基本操作
    Hadoop综合大作业
    hive基本操作与应用
    理解MapReduce计算构架
    熟悉HBase基本操作
    熟悉常用的HDFS操作
    爬虫大作业
  • 原文地址:https://www.cnblogs.com/zengezenge/p/1077418.html
Copyright © 2020-2023  润新知