Spring Boot: How to specify the PasswordEncoder?

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

    You need to set Password encoder , check the following sample

    PasswordEncoder encoder =
                 PasswordEncoderFactories.createDelegatingPasswordEncoder();
        auth.inMemoryAuthentication().passwordEncoder(encoder).withUser("Ahmad")
                .password("1600").roles("USER", "ADMIN").and().withUser("Belal").password("1515").roles("USER");
    

提交回复
热议问题