Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User.builder() and passwordEncoder().encode() implemented #12

Open
wants to merge 1 commit into
base: 3.3.1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,27 @@ SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Excepti
}

@Bean
public InMemoryUserDetailsManager userDetailsService() {

UserDetails user = User.withDefaultPasswordEncoder()
public InMemoryUserDetailsManager userDetailsManagerService() {
UserDetails user = User.builder()
.username("user")
.password("12345")
.password(passwordEncoder().encode("123456"))
.roles("USER")
.build();
UserDetails admin = User.withDefaultPasswordEncoder()

UserDetails admin = User.builder()
.username("admin")
.password("54321")
.password(passwordEncoder().encode("123456"))
.roles("USER", "ADMIN")
.build();

return new InMemoryUserDetailsManager(user, admin);
}

@Bean
protected PasswordEncoder passwordEncoder() {

return new BCryptPasswordEncoder();
}

}