Skip to content

Commit 371bee6

Browse files
ngocnhan-tran1996jzheaux
authored andcommitted
Polish User#withDefaultPasswordEncoder
Signed-off-by: Tran Ngoc Nhan <[email protected]>
1 parent f61a8de commit 371bee6

File tree

1 file changed

+3
-2
lines changed
  • docs/modules/ROOT/pages/servlet/authentication/passwords

1 file changed

+3
-2
lines changed

docs/modules/ROOT/pages/servlet/authentication/passwords/index.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ public class SecurityConfig {
3434
3535
@Bean
3636
public UserDetailsService userDetailsService() {
37-
// User.withDefaultPasswordEncoder() is considered unsafe for production
38-
// and is only intended for sample applications.
3937
UserDetails userDetails = User.withDefaultPasswordEncoder()
4038
.username("user")
4139
.password("password")
@@ -103,6 +101,9 @@ class SecurityConfig {
103101
----
104102
=====
105103

104+
[WARNING]
105+
`User#withDefaultPasswordEncoder` is considered unsafe for production and is only intended for sample applications. See javadoc:org.springframework.security.core.userdetails.User#withDefaultPasswordEncoder()[User#withDefaultPasswordEncoder] for more details.
106+
106107
The preceding configuration automatically registers an xref:servlet/authentication/passwords/in-memory.adoc[in-memory `UserDetailsService`] with the `SecurityFilterChain`, registers the xref:servlet/authentication/passwords/dao-authentication-provider.adoc[`DaoAuthenticationProvider`] with the default xref:servlet/authentication/architecture.adoc#servlet-authentication-authenticationmanager[`AuthenticationManager`], and enables xref:servlet/authentication/passwords/form.adoc[Form Login] and xref:servlet/authentication/passwords/basic.adoc[HTTP Basic] authentication.
107108

108109
To learn more about username/password authentication, consider the following use cases:

0 commit comments

Comments
 (0)