Fix documentation code block bug.

Closes gh-12980
This commit is contained in:
1993heqiang 2023-04-02 18:11:21 +08:00 committed by Rob Winch
parent 64a1ad5cd6
commit 54de5c9537
2 changed files with 4 additions and 4 deletions

View File

@ -213,7 +213,7 @@ There are convenience mechanisms to make this easier, but this is still not inte
.Java
[source,java,role="primary",attrs="-attributes"]
----
User user = User.withDefaultPasswordEncoder()
UserDetails user = User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("user")
@ -243,12 +243,12 @@ If you are creating multiple users, you can also reuse the builder:
[source,java,role="primary"]
----
UserBuilder users = User.withDefaultPasswordEncoder();
User user = users
UserDetails user = users
.username("user")
.password("password")
.roles("USER")
.build();
User admin = users
UserDetails admin = users
.username("admin")
.password("password")
.roles("USER","ADMIN")

View File

@ -820,7 +820,7 @@ Authentication authentication = this.authenticationManager.authenticate(token);
// ...
SecurityContext context = SecurityContextHolder.createEmptyContext(); <1>
context.setAuthentication(authentication); <2>
SecurityContextHolder.setContext(authentication); <3>
SecurityContextHolder.setContext(context); <3>
----
====