-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Closed
Labels
in: webAn issue in web modules (web, webmvc)An issue in web modules (web, webmvc)type: bugA general bugA general bug
Milestone
Description
Describe the bug
While AbstractPreAuthenticatedProcessingFilter::getPreAuthenticatedPrincipal is correctly annotated with @Nullable, the overriden method in RequestHeaderAuthenticationFilter is missing the annotation resulting in compilation errors when using Kotlin
To Reproduce
Create a Kotlin class that extends RequestHeaderAuthenticationFilter and override getPreAuthenticatedPrincipal.
Kotlin insists on non-nullable types, making null checks and null return values impossible.
Expected behavior
The return type should be correctly annotated with @Nullable, allowing null checks in Kotlin code overriding this method.
Sample
class EntraCompatibleRequestHeaderAuthenticationFilter : RequestHeaderAuthenticationFilter() {
override fun getPreAuthenticatedPrincipal(request: HttpServletRequest): String {
return super.getPreAuthenticatedPrincipal(request).toString().substringBefore('@')
}
}
but should be
class EntraCompatibleRequestHeaderAuthenticationFilter : RequestHeaderAuthenticationFilter() {
override fun getPreAuthenticatedPrincipal(request: HttpServletRequest): String? {
return super.getPreAuthenticatedPrincipal(request)?.toString()?.substringBefore('@')
}
}
Metadata
Metadata
Assignees
Labels
in: webAn issue in web modules (web, webmvc)An issue in web modules (web, webmvc)type: bugA general bugA general bug