flowable 账号密码加密
程序员文章站
2024-03-16 18:23:52
...
1.背景:
集成flowable的idm的时候,密码总是明文,这种肯定不行。
2.实现
2.1.配置config
@Configuration
public class IdmProcessEngineConfiguration extends SpringIdmEngineConfiguration {
@Bean
public PasswordEncoder bCryptEncoder() {
return new BCryptPasswordEncoder();
}
@Bean
public SpringEncoder passwordEncoder(){
return new SpringEncoder(bCryptEncoder());
}
@Override
public IdmEngineConfiguration setPasswordEncoder(org.flowable.idm.api.PasswordEncoder passwordEncoder) {
return super.setPasswordEncoder(passwordEncoder());
}
}
2.2.设置密码
UserEntity userEntity = (UserEntity) idmIdentityService.createUserQuery().userId(id).singleResult();
if (null!=userEntity) {
userEntity.setPassword(password);
idmIdentityService.updateUserPassword(userEntity);
}