diff --git a/ietf/api/tests.py b/ietf/api/tests.py index 87f7d684d32..e25eed4039e 100644 --- a/ietf/api/tests.py +++ b/ietf/api/tests.py @@ -886,31 +886,6 @@ def test_api_version(self): self.assertEqual(data['dumptime'], "2022-08-31 07:10:01 -0700") - def test_api_appauth(self): - for app in ["authortools", "bibxml"]: - url = urlreverse('ietf.api.views.app_auth', kwargs={"app": app}) - person = PersonFactory() - apikey = PersonalApiKeyFactory(endpoint=url, person=person) - - self.client.login(username=person.user.username,password=f'{person.user.username}+password') - self.client.logout() - - # error cases - # missing apikey - r = self.client.post(url, {}) - self.assertContains(r, 'Missing apikey parameter', status_code=400) - - # invalid apikey - r = self.client.post(url, {'apikey': 'foobar'}) - self.assertContains(r, 'Invalid apikey', status_code=403) - - # working case - r = self.client.post(url, {'apikey': apikey.hash()}) - self.assertEqual(r.status_code, 200) - jsondata = r.json() - self.assertEqual(jsondata['success'], True) - self.client.logout() - @override_settings(APP_API_TOKENS={"ietf.api.views.nfs_metrics": ["valid-token"]}) def test_api_nfs_metrics(self): url = urlreverse("ietf.api.views.nfs_metrics") diff --git a/ietf/api/urls.py b/ietf/api/urls.py index 7a082567b8a..d808ebc35aa 100644 --- a/ietf/api/urls.py +++ b/ietf/api/urls.py @@ -92,8 +92,6 @@ url(r'^submission/(?P[0-9]+)/status/?', submit_views.api_submission_status), # Datatracker version url(r'^version/?$', api_views.version), - # Application authentication API key - url(r'^appauth/(?Pauthortools|bibxml)$', api_views.app_auth), # NFS metrics endpoint url(r'^metrics/nfs/?$', api_views.nfs_metrics), # latest versions diff --git a/ietf/api/views.py b/ietf/api/views.py index 420bc396934..4dab7ab475e 100644 --- a/ietf/api/views.py +++ b/ietf/api/views.py @@ -229,14 +229,6 @@ def version(request): }), content_type='application/json', ) - - -@require_api_key -@csrf_exempt -def app_auth(request, app: Literal["authortools", "bibxml"]): - return HttpResponse( - json.dumps({'success': True}), - content_type='application/json') @requires_api_token @csrf_exempt diff --git a/ietf/ietfauth/tests.py b/ietf/ietfauth/tests.py index a77e5bd5d58..e997491835a 100644 --- a/ietf/ietfauth/tests.py +++ b/ietf/ietfauth/tests.py @@ -919,7 +919,7 @@ def test_apikey_errors(self): self.assertContains(r, 'Invalid apikey', status_code=403) # invalid apikey (invalidated api key) - unauthorized_url = urlreverse('ietf.api.views.app_auth', kwargs={'app': 'authortools'}) + unauthorized_url = person.available_api_endpoints()[0][0] invalidated_apikey = PersonalApiKeyFactory(endpoint=unauthorized_url, person=person, valid=False) r = self.client.post(unauthorized_url, {'apikey': invalidated_apikey.hash()}) self.assertContains(r, 'Invalid apikey', status_code=403) diff --git a/ietf/person/migrations/0006_alter_personalapikey_endpoint.py b/ietf/person/migrations/0006_alter_personalapikey_endpoint.py new file mode 100644 index 00000000000..1292acacc98 --- /dev/null +++ b/ietf/person/migrations/0006_alter_personalapikey_endpoint.py @@ -0,0 +1,40 @@ +# Generated by Django 4.2.30 on 2026-07-31 04:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("person", "0005_alter_historicalperson_pronouns_selectable_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="personalapikey", + name="endpoint", + field=models.CharField( + choices=[ + ("/api/iesg/position", "/api/iesg/position"), + ( + "/api/meeting/session/recording-name", + "/api/meeting/session/recording-name", + ), + ( + "/api/meeting/session/video/url", + "/api/meeting/session/video/url", + ), + ("/api/notify/meeting/bluesheet", "/api/notify/meeting/bluesheet"), + ( + "/api/notify/meeting/registration", + "/api/notify/meeting/registration", + ), + ("/api/notify/session/attendees", "/api/notify/session/attendees"), + ("/api/notify/session/chatlog", "/api/notify/session/chatlog"), + ("/api/notify/session/polls", "/api/notify/session/polls"), + ("/api/v2/person/person", "/api/v2/person/person"), + ], + max_length=128, + ), + ), + ] diff --git a/ietf/person/models.py b/ietf/person/models.py index 3ab89289a65..436030c65eb 100644 --- a/ietf/person/models.py +++ b/ietf/person/models.py @@ -399,8 +399,6 @@ def salt(): ("/api/notify/session/attendees", "/api/notify/session/attendees", "Recording Manager"), ("/api/notify/session/chatlog", "/api/notify/session/chatlog", "Recording Manager"), ("/api/notify/session/polls", "/api/notify/session/polls", "Recording Manager"), - ("/api/appauth/authortools", "/api/appauth/authortools", None), - ("/api/appauth/bibxml", "/api/appauth/bibxml", None), ] PERSON_API_KEY_ENDPOINTS = sorted(list(set([ (v, n) for (v, n, r) in PERSON_API_KEY_VALUES ])))