Skip to content

Commit ba8844a

Browse files
committed
Deprecate Kotlin methods that don't use reified types
Closes gh-10365
1 parent 7b98c2e commit ba8844a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

config/src/main/kotlin/org/springframework/security/config/web/servlet/HttpSecurityDsl.kt

+6
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
725725
* @param atFilter the location of another [Filter] that is already registered
726726
* (i.e. known) with Spring Security.
727727
*/
728+
@Deprecated("Use 'addFilterAt<T>(filter)' instead.")
728729
fun addFilterAt(filter: Filter, atFilter: Class<out Filter>) {
729730
this.http.addFilterAt(filter, atFilter)
730731
}
@@ -751,6 +752,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
751752
* @param T the location of another [Filter] that is already registered
752753
* (i.e. known) with Spring Security.
753754
*/
755+
@Suppress("DEPRECATION")
754756
inline fun <reified T: Filter> addFilterAt(filter: Filter) {
755757
this.addFilterAt(filter, T::class.java)
756758
}
@@ -776,6 +778,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
776778
* @param afterFilter the location of another [Filter] that is already registered
777779
* (i.e. known) with Spring Security.
778780
*/
781+
@Deprecated("Use 'addFilterAfter<T>(filter)' instead.")
779782
fun addFilterAfter(filter: Filter, afterFilter: Class<out Filter>) {
780783
this.http.addFilterAfter(filter, afterFilter)
781784
}
@@ -802,6 +805,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
802805
* @param T the location of another [Filter] that is already registered
803806
* (i.e. known) with Spring Security.
804807
*/
808+
@Suppress("DEPRECATION")
805809
inline fun <reified T: Filter> addFilterAfter(filter: Filter) {
806810
this.addFilterAfter(filter, T::class.java)
807811
}
@@ -827,6 +831,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
827831
* @param beforeFilter the location of another [Filter] that is already registered
828832
* (i.e. known) with Spring Security.
829833
*/
834+
@Deprecated("Use 'addFilterBefore<T>(filter)' instead.")
830835
fun addFilterBefore(filter: Filter, beforeFilter: Class<out Filter>) {
831836
this.http.addFilterBefore(filter, beforeFilter)
832837
}
@@ -853,6 +858,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
853858
* @param T the location of another [Filter] that is already registered
854859
* (i.e. known) with Spring Security.
855860
*/
861+
@Suppress("DEPRECATION")
856862
inline fun <reified T: Filter> addFilterBefore(filter: Filter) {
857863
this.addFilterBefore(filter, T::class.java)
858864
}

config/src/main/kotlin/org/springframework/security/config/web/servlet/oauth2/login/UserInfoEndpointDsl.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -53,6 +53,7 @@ class UserInfoEndpointDsl {
5353
* @param customUserType a custom [OAuth2User] type
5454
* @param clientRegistrationId the client registration identifier
5555
*/
56+
@Deprecated("Use 'customUserType<T>(clientRegistrationId)' instead.")
5657
fun customUserType(customUserType: Class<out OAuth2User>, clientRegistrationId: String) {
5758
customUserTypePair = Pair(customUserType, clientRegistrationId)
5859
}
@@ -65,6 +66,7 @@ class UserInfoEndpointDsl {
6566
* @param T a custom [OAuth2User] type
6667
* @param clientRegistrationId the client registration identifier
6768
*/
69+
@Suppress("DEPRECATION")
6870
inline fun <reified T: OAuth2User> customUserType(clientRegistrationId: String) {
6971
customUserType(T::class.java, clientRegistrationId)
7072
}

0 commit comments

Comments
 (0)