Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions ietf/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 0 additions & 2 deletions ietf/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@
url(r'^submission/(?P<submission_id>[0-9]+)/status/?', submit_views.api_submission_status),
# Datatracker version
url(r'^version/?$', api_views.version),
# Application authentication API key
url(r'^appauth/(?P<app>authortools|bibxml)$', api_views.app_auth),
# NFS metrics endpoint
url(r'^metrics/nfs/?$', api_views.nfs_metrics),
# latest versions
Expand Down
8 changes: 0 additions & 8 deletions ietf/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ietf/ietfauth/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
40 changes: 40 additions & 0 deletions ietf/person/migrations/0006_alter_personalapikey_endpoint.py
Original file line number Diff line number Diff line change
@@ -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,
),
),
]
2 changes: 0 additions & 2 deletions ietf/person/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ])))

Expand Down
Loading