From ba8844a67e71aad5c6891fecc175af4ed4172891 Mon Sep 17 00:00:00 2001 From: Eleftheria Stein Date: Wed, 13 Oct 2021 10:16:37 +0200 Subject: [PATCH] Deprecate Kotlin methods that don't use reified types Closes gh-10365 --- .../security/config/web/servlet/HttpSecurityDsl.kt | 6 ++++++ .../config/web/servlet/oauth2/login/UserInfoEndpointDsl.kt | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config/src/main/kotlin/org/springframework/security/config/web/servlet/HttpSecurityDsl.kt b/config/src/main/kotlin/org/springframework/security/config/web/servlet/HttpSecurityDsl.kt index 357b069259..d7a17f72af 100644 --- a/config/src/main/kotlin/org/springframework/security/config/web/servlet/HttpSecurityDsl.kt +++ b/config/src/main/kotlin/org/springframework/security/config/web/servlet/HttpSecurityDsl.kt @@ -725,6 +725,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu * @param atFilter the location of another [Filter] that is already registered * (i.e. known) with Spring Security. */ + @Deprecated("Use 'addFilterAt(filter)' instead.") fun addFilterAt(filter: Filter, atFilter: Class) { this.http.addFilterAt(filter, atFilter) } @@ -751,6 +752,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu * @param T the location of another [Filter] that is already registered * (i.e. known) with Spring Security. */ + @Suppress("DEPRECATION") inline fun addFilterAt(filter: Filter) { this.addFilterAt(filter, T::class.java) } @@ -776,6 +778,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu * @param afterFilter the location of another [Filter] that is already registered * (i.e. known) with Spring Security. */ + @Deprecated("Use 'addFilterAfter(filter)' instead.") fun addFilterAfter(filter: Filter, afterFilter: Class) { this.http.addFilterAfter(filter, afterFilter) } @@ -802,6 +805,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu * @param T the location of another [Filter] that is already registered * (i.e. known) with Spring Security. */ + @Suppress("DEPRECATION") inline fun addFilterAfter(filter: Filter) { this.addFilterAfter(filter, T::class.java) } @@ -827,6 +831,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu * @param beforeFilter the location of another [Filter] that is already registered * (i.e. known) with Spring Security. */ + @Deprecated("Use 'addFilterBefore(filter)' instead.") fun addFilterBefore(filter: Filter, beforeFilter: Class) { this.http.addFilterBefore(filter, beforeFilter) } @@ -853,6 +858,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu * @param T the location of another [Filter] that is already registered * (i.e. known) with Spring Security. */ + @Suppress("DEPRECATION") inline fun addFilterBefore(filter: Filter) { this.addFilterBefore(filter, T::class.java) } diff --git a/config/src/main/kotlin/org/springframework/security/config/web/servlet/oauth2/login/UserInfoEndpointDsl.kt b/config/src/main/kotlin/org/springframework/security/config/web/servlet/oauth2/login/UserInfoEndpointDsl.kt index 3ef981e958..0a5073fc9a 100644 --- a/config/src/main/kotlin/org/springframework/security/config/web/servlet/oauth2/login/UserInfoEndpointDsl.kt +++ b/config/src/main/kotlin/org/springframework/security/config/web/servlet/oauth2/login/UserInfoEndpointDsl.kt @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,6 +53,7 @@ class UserInfoEndpointDsl { * @param customUserType a custom [OAuth2User] type * @param clientRegistrationId the client registration identifier */ + @Deprecated("Use 'customUserType(clientRegistrationId)' instead.") fun customUserType(customUserType: Class, clientRegistrationId: String) { customUserTypePair = Pair(customUserType, clientRegistrationId) } @@ -65,6 +66,7 @@ class UserInfoEndpointDsl { * @param T a custom [OAuth2User] type * @param clientRegistrationId the client registration identifier */ + @Suppress("DEPRECATION") inline fun customUserType(clientRegistrationId: String) { customUserType(T::class.java, clientRegistrationId) }