zoukankan      html  css  js  c++  java
  • 如何定制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>



  • 相关阅读:
    学习日记(2.19 BP神经网络完整代码解读)
    学习日记(2.18)
    学习日记2.17
    学习日记(2.15---2.16)
    最后的作业
    C++第五次作业
    第四次作业:结对编程
    C++第四次作业
    第三次作业:原型设计
    conda基本操作
  • 原文地址:https://www.cnblogs.com/zengezenge/p/1077418.html
Copyright © 2011-2022 走看看