Skip to content

Commit

Permalink
API Key Creation & Management
Browse files Browse the repository at this point in the history
Added functionality for superusers and users to create and manage API keys, with Knox integration for secure key hashing.
  • Loading branch information
NEZRI Ygal authored and NEZRI Ygal committed Jul 24, 2024
1 parent fb81f59 commit 265e73d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions Watcher/Watcher/accounts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 5.0.2 on 2024-07-24 12:07

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
('knox', '0008_remove_authtoken_salt'),
]

operations = [
migrations.CreateModel(
name='APIKey',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('auth_token', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='knox.authtoken')),
],
options={
'verbose_name': 'API Key',
'verbose_name_plural': 'API Keys',
},
),
]
2 changes: 1 addition & 1 deletion Watcher/Watcher/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __str__(self):
class Meta:
verbose_name = "API Key"
verbose_name_plural = "API Keys"
app_label = 'auth'
app_label = 'accounts'


def make_inactive(sender, user, **kwargs):
Expand Down

0 comments on commit 265e73d

Please sign in to comment.