mirror of
https://github.com/ansible/awx.git
synced 2026-03-19 09:57:33 -02:30
Remove auth checks for /api/ and /api/v1/ to fix auth errors in UI after logging into munin.
This commit is contained in:
@@ -64,6 +64,7 @@ def api_exception_handler(exc):
|
|||||||
|
|
||||||
class ApiRootView(APIView):
|
class ApiRootView(APIView):
|
||||||
|
|
||||||
|
authentication_classes = []
|
||||||
permission_classes = (AllowAny,)
|
permission_classes = (AllowAny,)
|
||||||
view_name = 'REST API'
|
view_name = 'REST API'
|
||||||
|
|
||||||
@@ -82,6 +83,7 @@ class ApiRootView(APIView):
|
|||||||
|
|
||||||
class ApiV1RootView(APIView):
|
class ApiV1RootView(APIView):
|
||||||
|
|
||||||
|
authentication_classes = []
|
||||||
permission_classes = (AllowAny,)
|
permission_classes = (AllowAny,)
|
||||||
view_name = 'Version 1'
|
view_name = 'Version 1'
|
||||||
|
|
||||||
|
|||||||
@@ -53,12 +53,22 @@ class UsersTest(BaseTest):
|
|||||||
def test_auth_token_login(self):
|
def test_auth_token_login(self):
|
||||||
auth_token_url = reverse('api:auth_token_view')
|
auth_token_url = reverse('api:auth_token_view')
|
||||||
user_me_url = reverse('api:user_me_list')
|
user_me_url = reverse('api:user_me_list')
|
||||||
|
api_url = reverse('api:api_root_view')
|
||||||
|
api_v1_url = reverse('api:api_v1_root_view')
|
||||||
|
|
||||||
# Always returns a 405 for any GET request, regardless of credentials.
|
# Always returns a 405 for any GET request, regardless of credentials.
|
||||||
self.get(auth_token_url, expect=405, auth=None)
|
self.get(auth_token_url, expect=405, auth=None)
|
||||||
self.get(auth_token_url, expect=405, auth=self.get_invalid_credentials())
|
self.get(auth_token_url, expect=405, auth=self.get_invalid_credentials())
|
||||||
self.get(auth_token_url, expect=405, auth=self.get_normal_credentials())
|
self.get(auth_token_url, expect=405, auth=self.get_normal_credentials())
|
||||||
|
|
||||||
|
# /api/ and /api/v1 should work and ignore any credenials passed.
|
||||||
|
self.get(api_url, expect=200, auth=None)
|
||||||
|
self.get(api_url, expect=200, auth=self.get_invalid_credentials())
|
||||||
|
self.get(api_url, expect=200, auth=self.get_normal_credentials())
|
||||||
|
self.get(api_v1_url, expect=200, auth=None)
|
||||||
|
self.get(api_v1_url, expect=200, auth=self.get_invalid_credentials())
|
||||||
|
self.get(api_v1_url, expect=200, auth=self.get_normal_credentials())
|
||||||
|
|
||||||
# Posting without username/password fields or invalid username/password
|
# Posting without username/password fields or invalid username/password
|
||||||
# returns a 400 error.
|
# returns a 400 error.
|
||||||
data = {}
|
data = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user