Spring Boot: How to specify the PasswordEncoder?

前端 未结 15 1178
醉梦人生
醉梦人生 2020-12-02 06:27

Currently I got the main class:

package com.recweb.springboot;

import org.springframework.boot.SpringApplication;
im         


        
15条回答
  •  星月不相逢
    2020-12-02 06:58

    A few days ago I have to face the same problem on spring security version (5.0.8). See the example version here:
    
    code:
    
    @Override
        protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    
    auth
                    .inMemoryAuthentication()
                    .passwordEncoder(NoOpPasswordEncoder.getInstance())
                    .withUser("farid").password("farid").roles("USER")
                    .and()
                    .withUser("admin").password("admin").roles("ADMIN");
        }
    
    OR
    
    When you are configuring the ClientDetailsServiceConfigurer, you have to also apply the new password storag`enter code here`e format to the client secret.
    
    .secret("{noop}secret")
    

    you can see the link: enter link description here

提交回复
热议问题