Deprecate legacy OAuth2 Application feature (#7045)

* Marked APIs legacy OAuth applications as deprecated

* Readded deprecation

* Fixed linter

* Added more deprecated mark to Oauth2 Api apps

* Fixed deprecation errors

* Fix tests
This commit is contained in:
Stevenson Michel
2025-08-06 14:49:19 -04:00
committed by thedoubl3j
parent 6bd7c3831f
commit dfad93cf4c
5 changed files with 33 additions and 2 deletions

View File

@@ -60,6 +60,7 @@ register(
},
label=_('OAuth 2 Timeout Settings'),
help_text=_(
'DEPRECATED: This setting is for a legacy feature and will be removed. Use token-based authentication instead.'
'Dictionary for customizing OAuth 2 timeouts, available items are '
'`ACCESS_TOKEN_EXPIRE_SECONDS`, the duration of access tokens in the number '
'of seconds, `AUTHORIZATION_CODE_EXPIRE_SECONDS`, the duration of '

View File

@@ -1123,15 +1123,31 @@ class UserMeList(ListAPIView):
class OAuth2ApplicationList(ListCreateAPIView):
"""
DEPRECATED: This endpoint will be removed in a future release.
Please use Application Tokens or Personal Access Tokens instead.
"""
name = _("OAuth 2 Applications")
deprecated = True
model = models.OAuth2Application
serializer_class = serializers.OAuth2ApplicationSerializer
swagger_topic = 'Authentication'
def post(self, request, *args, **kwargs):
logger.warning("This feature is deprecated and will be removed. " "Thus, it is recommended to migrate to token-based authentication.")
return super().post(request, *args, **kwargs)
class OAuth2ApplicationDetail(RetrieveUpdateDestroyAPIView):
"""
DEPRECATED: This endpoint will be removed in a future release.
Please use Application Tokens or Personal Access Tokens instead.
"""
name = _("OAuth 2 Application Detail")
deprecated = True
model = models.OAuth2Application
serializer_class = serializers.OAuth2ApplicationSerializer
@@ -1154,6 +1170,12 @@ class ApplicationOAuth2TokenList(SubListCreateAPIView):
class OAuth2ApplicationActivityStreamList(SubListAPIView):
"""
DEPRECATED: This endpoint will be removed in a future release.
Please use Application Tokens or Personal Access Tokens instead.
"""
deprecated = True
model = models.ActivityStream
serializer_class = serializers.ActivityStreamSerializer
parent_model = models.OAuth2Application