Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
9 changes: 9 additions & 0 deletions .vscode/mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"servers": {
"testownik_local": {
"url": "http://localhost:8000/api/mcp",
"type": "http"
}
},
"inputs": []
}
Empty file.
14 changes: 14 additions & 0 deletions oauth_integrations/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from django.contrib import admin
from unfold.admin import ModelAdmin

from oauth_integrations.models import OAuthClientMetadata


@admin.register(OAuthClientMetadata)
class OAuthClientMetadataAdmin(ModelAdmin):
list_display = ["client_name", "client_id_url", "application", "fetched_at", "cache_expires_at"]
list_filter = ["fetched_at", "cache_expires_at", "token_endpoint_auth_method"]
search_fields = ["client_name", "client_id_url", "client_uri"]
readonly_fields = ["fetched_at", "cache_expires_at"]

autocomplete_fields = ["application"]
6 changes: 6 additions & 0 deletions oauth_integrations/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class OAuthIntegrationsConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "oauth_integrations"
59 changes: 59 additions & 0 deletions oauth_integrations/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Generated by Django 6.0.5 on 2026-06-03 07:42

import uuid

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


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.OAUTH2_PROVIDER_APPLICATION_MODEL),
]

operations = [
migrations.CreateModel(
name="OAuthClientMetadata",
fields=[
(
"id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
),
),
("client_id_url", models.URLField(max_length=2048, unique=True)),
("client_name", models.CharField(max_length=255)),
("client_uri", models.URLField(blank=True, max_length=2048)),
("logo_uri", models.URLField(blank=True, max_length=2048)),
("redirect_uris", models.JSONField(default=list)),
("grant_types", models.JSONField(default=list)),
("response_types", models.JSONField(default=list)),
(
"token_endpoint_auth_method",
models.CharField(default="none", max_length=64),
),
("metadata", models.JSONField(default=dict)),
("fetched_at", models.DateTimeField()),
("cache_expires_at", models.DateTimeField(blank=True, null=True)),
(
"application",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
related_name="cimd_metadata",
to=settings.OAUTH2_PROVIDER_APPLICATION_MODEL,
),
),
],
options={
"verbose_name": "OAuth client metadata",
"verbose_name_plural": "OAuth client metadata",
},
),
]
Empty file.
31 changes: 31 additions & 0 deletions oauth_integrations/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import uuid

from django.db import models


class OAuthClientMetadata(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
application = models.OneToOneField(
"oauth2_provider.Application",
on_delete=models.CASCADE,
related_name="cimd_metadata",
Comment thread
Antoni-Czaplicki marked this conversation as resolved.
swappable=False,
)
client_id_url = models.URLField(max_length=2048, unique=True)
client_name = models.CharField(max_length=255)
client_uri = models.URLField(max_length=2048, blank=True)
logo_uri = models.URLField(max_length=2048, blank=True)
redirect_uris = models.JSONField(default=list)
grant_types = models.JSONField(default=list)
response_types = models.JSONField(default=list)
token_endpoint_auth_method = models.CharField(max_length=64, default="none")
metadata = models.JSONField(default=dict)
fetched_at = models.DateTimeField()
cache_expires_at = models.DateTimeField(null=True, blank=True)

class Meta:
verbose_name = "OAuth client metadata"
verbose_name_plural = "OAuth client metadata"

def __str__(self):
return self.client_name or self.client_id_url
Loading
Loading