Fix compile warnings for spring-security-config#18596
Fix compile warnings for spring-security-config#18596023-dev wants to merge 3 commits intospring-projects:mainfrom
Conversation
|
Thank you. Unfortunately, the build fails with the changes. Can you please update the pull request to resolve the errors? |
|
@rwinch |
Signed-off-by: 023-dev <0_2_3@naver.com>
|
@rwinch |
|
@023-dev It appears that that the build is still failing. Would you mind taking a look at it? You can check the build using the same steps in the linked CI. |
Signed-off-by: 023-dev <0_2_3@naver.com>
Head branch was pushed to by a user without write access
|
Thank you for the feedback, and I apologize for missing the previous build failure. |
Explicitly configure Instancio for OneTimeTokenAuthenticationToken in SerializationSamples.java. This ensures that the generated test instances use a valid, serializable principal (null) instead of the default Object() which causes serialization failures. Signed-off-by: 023-dev <0_2_3@naver.com>
rwinch
left a comment
There was a problem hiding this comment.
Thanks. I've provided feedback inline
| } | ||
|
|
||
| tasks.withType(KotlinCompile) { | ||
| kotlinOptions.allWarningsAsErrors = true |
There was a problem hiding this comment.
Why was this removed? I think that we still need to fail if there are kotlin warnings.
| * @property defaultsDisabled whether all of the default headers should be included in the response | ||
| */ | ||
| @SecurityMarker | ||
| @Suppress("DEPRECATION") |
There was a problem hiding this comment.
We cannot add suppress deprecation here because the HeadersDsl is not also deprecated. Instead add it to the specific parts that are using deprecations and ensure that the method that uses them is also deprecated.
| Authentication authentication = TestAuthentication.authenticated(user); | ||
| SecurityContext securityContext = new SecurityContextImpl(authentication); | ||
|
|
||
| instancioByClassName.put(OneTimeTokenAuthenticationToken.class, () -> { |
There was a problem hiding this comment.
I think that since this is a test, we should leave this alone and suppress the warning
This PR removes all compiler warnings from the
spring-security-configmodule and applies thecompile-warnings-errorplugin to prevent future warnings.Changes
Java Changes
SpringOpaqueTokenIntrospectorconstructor with the new Builder pattern introduced in Spring Security 6.5new SpringOpaqueTokenIntrospector(introspectionUri, clientId, clientSecret)SpringOpaqueTokenIntrospector.withIntrospectionUri(...).clientId(...).clientSecret(...).build()Kotlin Changes
AuthorizeHttpRequestsDsl.kt:
Object::class.javawithAny::class.java(Kotlin best practice)resolveRolePrefix()andresolveRoleHierarchy()return types to nullable to fix "condition always true" warningsHeadersDsl.kt: Added
@Suppress("DEPRECATION")for deprecatedHpkpConfigusage (class itself is deprecated)HttpSecurityDsl.kt: Added
@Suppress("DEPRECATION")for deprecatedrequiresChannel()methodRequiresChannelDsl.kt: Added
@file:Suppress("DEPRECATION")for deprecated channel security classesX509Dsl.kt: Added
@Suppress("DEPRECATION")for deprecatedsubjectPrincipalRegexpropertyHttpPublicKeyPinningDsl.kt: Added
@file:Suppress("DEPRECATION")for deprecated HPKP classesSessionFixationDsl.kt: Removed unnecessary null case in when expression
Build Configuration
compile-warnings-errorplugin to fail build on warningsTesting
Related Issues
Closes gh-18419