mirror of
https://github.com/ansible/awx.git
synced 2026-05-24 00:57:48 -02:30
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:
committed by
thedoubl3j
parent
6bd7c3831f
commit
dfad93cf4c
@@ -60,6 +60,7 @@ register(
|
|||||||
},
|
},
|
||||||
label=_('OAuth 2 Timeout Settings'),
|
label=_('OAuth 2 Timeout Settings'),
|
||||||
help_text=_(
|
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 '
|
'Dictionary for customizing OAuth 2 timeouts, available items are '
|
||||||
'`ACCESS_TOKEN_EXPIRE_SECONDS`, the duration of access tokens in the number '
|
'`ACCESS_TOKEN_EXPIRE_SECONDS`, the duration of access tokens in the number '
|
||||||
'of seconds, `AUTHORIZATION_CODE_EXPIRE_SECONDS`, the duration of '
|
'of seconds, `AUTHORIZATION_CODE_EXPIRE_SECONDS`, the duration of '
|
||||||
|
|||||||
@@ -1123,15 +1123,31 @@ class UserMeList(ListAPIView):
|
|||||||
|
|
||||||
|
|
||||||
class OAuth2ApplicationList(ListCreateAPIView):
|
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")
|
name = _("OAuth 2 Applications")
|
||||||
|
deprecated = True
|
||||||
|
|
||||||
model = models.OAuth2Application
|
model = models.OAuth2Application
|
||||||
serializer_class = serializers.OAuth2ApplicationSerializer
|
serializer_class = serializers.OAuth2ApplicationSerializer
|
||||||
swagger_topic = 'Authentication'
|
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):
|
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")
|
name = _("OAuth 2 Application Detail")
|
||||||
|
deprecated = True
|
||||||
|
|
||||||
model = models.OAuth2Application
|
model = models.OAuth2Application
|
||||||
serializer_class = serializers.OAuth2ApplicationSerializer
|
serializer_class = serializers.OAuth2ApplicationSerializer
|
||||||
@@ -1154,6 +1170,12 @@ class ApplicationOAuth2TokenList(SubListCreateAPIView):
|
|||||||
|
|
||||||
|
|
||||||
class OAuth2ApplicationActivityStreamList(SubListAPIView):
|
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
|
model = models.ActivityStream
|
||||||
serializer_class = serializers.ActivityStreamSerializer
|
serializer_class = serializers.ActivityStreamSerializer
|
||||||
parent_model = models.OAuth2Application
|
parent_model = models.OAuth2Application
|
||||||
|
|||||||
@@ -265,3 +265,7 @@ plugin_routing:
|
|||||||
removal_date: '2022-01-23'
|
removal_date: '2022-01-23'
|
||||||
warning_text: The tower_* modules have been deprecated, use awx.awx.workflow_node_wait instead.
|
warning_text: The tower_* modules have been deprecated, use awx.awx.workflow_node_wait instead.
|
||||||
redirect: awx.awx.workflow_node_wait
|
redirect: awx.awx.workflow_node_wait
|
||||||
|
application:
|
||||||
|
deprecation:
|
||||||
|
removal_version: '25.0.0'
|
||||||
|
warning_text: The application module manages a legacy authentication feature that is being phased out, migrate to token-based authentication instead.
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ DOCUMENTATION = '''
|
|||||||
module: application
|
module: application
|
||||||
author: "Geoffrey Bacheot (@jffz)"
|
author: "Geoffrey Bacheot (@jffz)"
|
||||||
short_description: create, update, or destroy Automation Platform Controller applications
|
short_description: create, update, or destroy Automation Platform Controller applications
|
||||||
|
deprecated:
|
||||||
|
removed_in: '25.0.0'
|
||||||
|
why: This module manages a legacy authentication feature that is being phased out.
|
||||||
|
alternative: Migrate to token-based authentication.
|
||||||
description:
|
description:
|
||||||
- Create, update, or destroy Automation Platform Controller applications. See
|
- Create, update, or destroy Automation Platform Controller applications. See
|
||||||
U(https://www.ansible.com/tower) for an overview.
|
U(https://www.ansible.com/tower) for an overview.
|
||||||
@@ -28,7 +32,7 @@ options:
|
|||||||
type: str
|
type: str
|
||||||
new_name:
|
new_name:
|
||||||
description:
|
description:
|
||||||
- Setting this option will change the existing name (looked up via the name field.
|
- Setting this option will change the existing name (looked up via the name field).
|
||||||
type: str
|
type: str
|
||||||
description:
|
description:
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ def test_export(run_module, admin_user):
|
|||||||
all_assets_except_users = {k: v for k, v in assets.items() if k != 'users'}
|
all_assets_except_users = {k: v for k, v in assets.items() if k != 'users'}
|
||||||
|
|
||||||
for k, v in all_assets_except_users.items():
|
for k, v in all_assets_except_users.items():
|
||||||
assert v == [], f"Expected resource {k} to be empty. Instead it is {v}"
|
assert v == [] or v is None, f"Expected resource {k} to be empty. Instead it is {v}"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
|
|||||||
Reference in New Issue
Block a user