Spring Boot: How to specify the PasswordEncoder?

前端 未结 15 1105
醉梦人生
醉梦人生 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 07:07

    @Override
    public void configure(AuthenticationManagerBuilder auth) throws Exception{    
        auth.inMemoryAuthentication().passwordEncoder(NoOpPasswordEncoder.getInstance())
                .withUser("test").password("test123").roles("USER").and()
                .withUser("test1").password("test123").roles("ADMIN");
    }
    

提交回复
热议问题