From fafb579a6e3d6ca25777d6cc35fa1cb5c62b01d5 Mon Sep 17 00:00:00 2001 From: "Dong, Xue-Han" Date: Thu, 2 Nov 2023 08:02:00 +0800 Subject: [PATCH] fix code blocks formatting mistakes. --- .../ROOT/pages/servlet/architecture.adoc | 23 ++++++++++++------- .../servlet/authentication/architecture.adoc | 4 ++-- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/docs/modules/ROOT/pages/servlet/architecture.adoc b/docs/modules/ROOT/pages/servlet/architecture.adoc index 85623738fa..d42b2ffc16 100644 --- a/docs/modules/ROOT/pages/servlet/architecture.adoc +++ b/docs/modules/ROOT/pages/servlet/architecture.adoc @@ -174,8 +174,10 @@ However, there are times that it is beneficial to know the ordering, if you want To exemplify the above paragraph, let's consider the following security configuration: -==== -.Java +[tabs] +====== +Java:: ++ [source,java,role="primary"] ---- @Configuration @@ -196,7 +198,9 @@ public class SecurityConfig { } ---- -.Kotlin + +Kotlin:: ++ [source,kotlin,role="secondary"] ---- import org.springframework.security.config.web.servlet.invoke @@ -220,7 +224,7 @@ class SecurityConfig { } ---- -==== +====== The above configuration will result in the following `Filter` ordering: @@ -336,8 +340,9 @@ Instead of implementing `Filter`, you can extend from {spring-framework-api-url} Now, we need to add the filter to the security filter chain. -==== -.Java +====== +Java:: ++ [source,java,role="primary"] ---- @Bean @@ -348,7 +353,9 @@ SecurityFilterChain filterChain(HttpSecurity http) throws Exception { return http.build(); } ---- -.Kotlin + +Kotlin:: ++ [source,kotlin,role="secondary"] ---- @Bean @@ -359,7 +366,7 @@ fun filterChain(http: HttpSecurity): SecurityFilterChain { return http.build() } ---- -==== +====== <1> Use `HttpSecurity#addFilterBefore` to add the `TenantFilter` before the `AuthorizationFilter`. diff --git a/docs/modules/ROOT/pages/servlet/authentication/architecture.adoc b/docs/modules/ROOT/pages/servlet/authentication/architecture.adoc index 1d99ef6b38..0c43958a77 100644 --- a/docs/modules/ROOT/pages/servlet/authentication/architecture.adoc +++ b/docs/modules/ROOT/pages/servlet/authentication/architecture.adoc @@ -31,7 +31,7 @@ If it contains a value, it is used as the currently authenticated user. The simplest way to indicate a user is authenticated is to set the `SecurityContextHolder` directly: .Setting `SecurityContextHolder` -==== + [tabs] ====== Java:: @@ -66,7 +66,7 @@ Here, we use `TestingAuthenticationToken`, because it is very simple. A more common production scenario is `UsernamePasswordAuthenticationToken(userDetails, password, authorities)`. <3> Finally, we set the `SecurityContext` on the `SecurityContextHolder`. Spring Security uses this information for xref:servlet/authorization/index.adoc#servlet-authorization[authorization]. -==== + To obtain information about the authenticated principal, access the `SecurityContextHolder`.