小编jos*_*edo的帖子

在 Spring 中使用 Bcrypt

我正在本地登录并且知道我的密码以纯文本形式存储在 h2 数据库中。

我想Bcrypt在 spring 中使用,但在我的应用程序启动时出现此错误:

Field bCryptPasswordEncoder in com.alert.interservices.uaa.Bootstrap required a bean of type 'org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder' that could not be found.
Run Code Online (Sandbox Code Playgroud)

要使用Bcrypt我只在我的控制器中自动连接它并加密密码。填充数据库时,我在 Bootstrap 上做了同样的事情:

控制器:

@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;

/**
 * 
 * @param user the user that is trying to access
 * @return the user if it is successfull or a bad request if not
 */
@RequestMapping(value = "/authenticate", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Object authenticate(@RequestBody UserEntity user) {

    logger.debug("Begin request UAAController.authenticate()");

    String encriptedPasswd=bCryptPasswordEncoder.encode(user.getPassword().getPassword()); …
Run Code Online (Sandbox Code Playgroud)

java spring bcrypt spring-boot

5
推荐指数
2
解决办法
1万
查看次数

在反应中打开一个弹出窗口

我想在单击反应按钮时打开一个弹出窗口,我有这个,但弹出窗口不会出现:

 <button type="button" class="btn btn-primary" data-toggle="modal" data-target={`#${props.idMessage}`}>
                {props.idMessage}
            </button>


            <div class="modal fade" id={props.idMessage} tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
Run Code Online (Sandbox Code Playgroud)

使用 React 调试工具,我可以看到 props.id 明显不同,并且我的数据目标上的值与我的 id 相同,正如您所看到的,应该出现弹出窗口:

在此输入图像描述

javascript reactjs bootstrap-4

3
推荐指数
1
解决办法
3万
查看次数

标签 统计

bcrypt ×1

bootstrap-4 ×1

java ×1

javascript ×1

reactjs ×1

spring ×1

spring-boot ×1