From 018cbfa93f268d055f99e2a8f0bdd3dd683d644c Mon Sep 17 00:00:00 2001 From: Eleftheria Stein Date: Mon, 30 Mar 2020 11:31:59 -0400 Subject: [PATCH] Add preauth Kotlin samples to docs Issue gh-8172 --- .../_includes/servlet/authentication/preauth.adoc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/manual/src/docs/asciidoc/_includes/servlet/authentication/preauth.adoc b/docs/manual/src/docs/asciidoc/_includes/servlet/authentication/preauth.adoc index e68229393c..c50de6379f 100644 --- a/docs/manual/src/docs/asciidoc/_includes/servlet/authentication/preauth.adoc +++ b/docs/manual/src/docs/asciidoc/_includes/servlet/authentication/preauth.adoc @@ -29,13 +29,25 @@ We just provide an outline here so you should consult the Javadoc and source whe This class will check the current contents of the security context and, if empty, it will attempt to extract user information from the HTTP request and submit it to the `AuthenticationManager`. Subclasses override the following methods to obtain this information: -[source,java] +.Override AbstractPreAuthenticatedProcessingFilter +==== +.Java +[source,java,role="primary"] ---- protected abstract Object getPreAuthenticatedPrincipal(HttpServletRequest request); protected abstract Object getPreAuthenticatedCredentials(HttpServletRequest request); ---- +.Kotlin +[source,kotlin,role="secondary"] +---- +protected abstract fun getPreAuthenticatedPrincipal(request: HttpServletRequest): Any? + +protected abstract fun getPreAuthenticatedCredentials(request: HttpServletRequest): Any? +---- +==== + After calling these, the filter will create a `PreAuthenticatedAuthenticationToken` containing the returned data and submit it for authentication. By "authentication" here, we really just mean further processing to perhaps load the user's authorities, but the standard Spring Security authentication architecture is followed.