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>



  • 相关阅读:
    ACL2019对话、问答相关论文整理
    docker for windows添加卷映射
    聊聊多轮任务型对话那些事
    创建用户故事地图(User Story Mapping)的8个步骤
    关于如何做出好的产品
    知识体系整理
    关于如何做好需求的方法
    使用rasa搭建聊天机器人
    【转载】指代消解笔记
    计算机相关会议排名(一)
  • 原文地址:https://www.cnblogs.com/zengezenge/p/1077418.html
Copyright © 2011-2022 走看看