From 54de5c95379e50e2e41b367c528f5d5bb86163a0 Mon Sep 17 00:00:00 2001 From: 1993heqiang <531364804@qq.com> Date: Sun, 2 Apr 2023 18:11:21 +0800 Subject: [PATCH] Fix documentation code block bug. Closes gh-12980 --- .../pages/features/authentication/password-storage.adoc | 6 +++--- .../pages/servlet/authentication/session-management.adoc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/modules/ROOT/pages/features/authentication/password-storage.adoc b/docs/modules/ROOT/pages/features/authentication/password-storage.adoc index 95d511debe..251002b927 100644 --- a/docs/modules/ROOT/pages/features/authentication/password-storage.adoc +++ b/docs/modules/ROOT/pages/features/authentication/password-storage.adoc @@ -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") diff --git a/docs/modules/ROOT/pages/servlet/authentication/session-management.adoc b/docs/modules/ROOT/pages/servlet/authentication/session-management.adoc index 3b7115f815..6c46ba4478 100644 --- a/docs/modules/ROOT/pages/servlet/authentication/session-management.adoc +++ b/docs/modules/ROOT/pages/servlet/authentication/session-management.adoc @@ -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> ---- ====