There is no PasswordEncoder mapped for the id "null"

因为Spring-Security从4+升级到5+,导致There is no PasswordEncoder mapped for the id “null”错误。

解决方案:
1.可在密码验证类中添加
@Bean
public static NoOpPasswordEncoder passwordEncoder() {
  return (NoOpPasswordEncoder) NoOpPasswordEncoder.getInstance();
}

2.或者在xml配置文件中添加
<b:bean id="passwordEncoder"    class="org.springframework.security.crypto.password.NoOpPasswordEncoder" factory-method="getInstance"/>

原文地址:https://www.cnblogs.com/java51/p/12080765.html

时间: 2024-08-30 03:32:09

There is no PasswordEncoder mapped for the id "null"的相关文章

java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id &quot;null&quot;

今天在配置spring-security.xml配置文件时出错 错误如下: 严重: Servlet.service() for servlet [security] in context with path [] threw exception java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null" at org.springframework.security.c

java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id &quot;null&quot;报错

出现问题的原因: 内存用户验证时,Spring boot 2.0.1引用的security 依赖是 spring security 5.X版本,此版本需要提供一个PasswordEncorder的实例,否则后台汇报错误: java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null" 并且页面毫无响应. 解决方法: 创建PasswordEncorder的实现类MyPassw

java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id “null”

在spring security中设置默认的登录人的信息,遇到的异常信息: java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id “null” 有些版本不要求这样子做,所以就不会有该问题的发生, 我现在用的是5.0版本,强制要求提供一个,所以我们就给一个PasswordEncoder给他. 我们也可以使用Spring自带的PasswordEncoder.为了方便起见,我们以明文形式存密码

解决java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id &quot;null&quot;

问题描述: 使用springboot,权限管理使用spring security,使用内存用户验证,但无响应报错: java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null" 解决方式 ①: 创建MyPasswordEncoder类实现PasswordEncoder,加注解  @Component @Component public class MyPasswordEn

yii save model return id null

/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $news=new News; $news_item = new NewsItem; $news->item = $news_item; // Uncomment the following line if AJA

Spring Cloud 微服务中搭建 OAuth2.0 认证授权服务

在使用 Spring Cloud 体系来构建微服务的过程中,用户请求是通过网关(ZUUL 或 Spring APIGateway)以 HTTP 协议来传输信息,API 网关将自己注册为 Eureka 服务治理下的应用,同时也从 Eureka 服务中获取所有其他微服务的实例信息.搭建 OAuth2 认证授权服务,并不是给每个微服务调用,而是通过 API 网关进行统一调用来对网关后的微服务做前置过滤,所有的请求都必须先通过 API 网关,API 网关在进行路由转发之前对该请求进行前置校验,实现对微服

spring security 5.0 密码未加密报错

使用spring security5.0后,配置文件中直接写普通的密码如:123456,会报错: java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null" 这是因为spring security5.0以后默认需要选择密码加密方式,如果还像之前版本直接配置未加密密码,就会报上面这个错误当然啦,如果还想用简单密码的话,spring security还是给了两个方案,一种是

SpringBoot日记——Spring的安全配置-登录认证与授权

安全是每个项目开发中都需要考虑的,比如权限控制,安全认证,防止漏洞攻击等. 比较常见的安全框架有:Apache的shiro.Spring Security等等,相信用shiro的用户群体更多,而security功能更多一些. 那么我们就来看看Spring自己的Security是如何使用的.关于shiro后边一定会有其他文章补充的~. 官方文档-入门链接 Spring Security环境搭建 1).首先我们要有一个可以用来做测试的页面,不然做了权限控制也不知道有没有效果,那么我下边简单的列一个登

Spring Security 5.0的DelegatingPasswordEncoder详解

本文参考自Spring Security 5.0.4.RELEASE 的官方文档,结合源码介绍了 DelegatingPasswordEncoder,对其工作过程进行分析并解决其中遇到的问题.包括 There is no PasswordEncoder mapped for the id "null" 非法参数异常的正确处理方法. PasswordEncoder首先要理解 DelegatingPasswordEncoder 的作用和存在意义,明白官方为什么要使用它来取代原先的 NoOp