From 2bee044f90d67dd09104cc96c6dafd35f2aaf864 Mon Sep 17 00:00:00 2001 From: Eric Blau Date: Wed, 22 Jan 2025 11:39:17 -0600 Subject: [PATCH] Addresses issues #1,2,3 --- README.md | 6 ++--- cilogon_tokenauth/migrations/0001_initial.py | 28 ++++++++++++++++++++ cilogon_tokenauth/models.py | 4 --- 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 cilogon_tokenauth/migrations/0001_initial.py diff --git a/README.md b/README.md index 23f3b13..5041379 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,10 @@ value from the CILogon userinfo endpoint (or create a user if one does not alrea So as not to overtax the CILogon introspection endpoint, should many API requests come through at the same time, the token's introspection information is cached for a settable amount of time. Set the value in seconds in settings.py as TOKENAUTH_INTROSPECTION_CACHE_EXPIRATION. You must register a CILogon OIDC client at registry.access-ci.org. -Your values for Client ID and Secret must then be put in settings as CLIENT_KEY and CLIENT_SECRET +Your values for Client ID and Secret must then be put in settings as CILOGON_CLIENT_KEY and CILOGON_CLIENT_SECRET Settings: -CLIENT_KEY -CLIENT_SECRET +CILOGON_CLIENT_KEY +CILOGON_CLIENT_SECRET TOKENAUTH_INTROSPECTION_CACHE_EXPIRATION diff --git a/cilogon_tokenauth/migrations/0001_initial.py b/cilogon_tokenauth/migrations/0001_initial.py new file mode 100644 index 0000000..e076e9d --- /dev/null +++ b/cilogon_tokenauth/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# Generated by Django 4.1.13 on 2024-11-08 22:35 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='CachedToken', + fields=[ + ('id', models.CharField(max_length=256, primary_key=True, serialize=False)), + ('scope', models.CharField(max_length=128)), + ('issued_at', models.FloatField()), + ('expires_at', models.FloatField()), + ('last_introspection', models.FloatField()), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/cilogon_tokenauth/models.py b/cilogon_tokenauth/models.py index 1530e2e..c8929c0 100644 --- a/cilogon_tokenauth/models.py +++ b/cilogon_tokenauth/models.py @@ -9,10 +9,6 @@ class CachedToken(models.Model): - ID_SCOPE = 'identifiers.globus.org' - SCOPE_PERMISSIONS = { - } - id = models.CharField(max_length=256, primary_key=True) user = models.ForeignKey(User, on_delete=models.CASCADE) scope = models.CharField(max_length=128)