【问题标题】:Spring security 3 how to do change passwordSpring Security 3 如何更改密码
【发布时间】:2011-09-05 02:24:58
【问题描述】:

我使用 spring security 登录选项。现在我想添加一个更改密码选项。第一次用户登录到系统更改密码选项需要出现或重定向到更改密码页面。 这是我的 spring 安全文件

<bean id="daoAuthenticationProvider"
    class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
    <property name="userDetailsService" ref="userDetailsService" />
</bean>

<bean id="authenticationManager"
    class="org.springframework.security.authentication.ProviderManager">
    <property name="providers">
        <list>
            <ref local="daoAuthenticationProvider" />
        </list>
    </property>
</bean>

<security:authentication-manager>
    <security:authentication-provider user-service-ref="userDetailsService">
        <security:password-encoder ref="passwordEncoder">
            <security:salt-source ref="saltSource"/>
        </security:password-encoder>
    </security:authentication-provider>
</security:authentication-manager>

<bean id="saltSource" class="com.rcfi.lankaweb.linklk.support.service.SaltService"></bean>

<bean id="passwordEncoder" class="com.rcfi.lankaweb.linklk.support.service.PasswordVerifier"></bean>

<bean id="userDetailsService"
    class="com.rcfi.lankaweb.linklk.support.service.UserDetailsServiceImpl">
</bean>

【问题讨论】:

标签: spring passwords spring-security


【解决方案1】:

在您的com.rcfi.lankaweb.linklk.support.service.UserDetailsServiceImpl 中创建更改密码方法 这将通过您的用户 dao(可能)获取新字符串并保存到登录用户的数据库中

【讨论】:

  • Thanx NimChimpsky,从你那里得到想法,然后做剩下的。
猜你喜欢
  • 2014-09-13
  • 2017-04-16
  • 2018-01-15
  • 2014-03-24
  • 2023-03-09
  • 2013-03-21
  • 2011-06-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多