Skip to content
Open
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
21 changes: 6 additions & 15 deletions interfaces/auth_proxy/interface/v0/schema.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
"""This file defines the schemas for the provider and requirer sides of the auth_proxy interface.
It exposes two interfaces.schema_base.DataBagSchema subclasses called:
- ProviderSchema
- RequirerSchema

Examples:
RequirerSchema:
Requirer:
unit: <empty>
app: {
"providers": [
Expand All @@ -14,16 +11,15 @@
]
}

ProviderSchema:
Provider:
unit: <empty>
app: <empty>
"""

from interface_tester.schema_base import DataBagSchema
from pydantic import AnyHttpUrl, BaseModel, Field


class AuthProxyRequirer(BaseModel):
class RequirerAppData(BaseModel):
protected_urls: list[AnyHttpUrl] = Field(
description="List of urls to be protected by Identity and Access Proxy."
)
Expand All @@ -35,11 +31,6 @@ class AuthProxyRequirer(BaseModel):
)


class ProviderSchema(DataBagSchema):
"""Provider schema for auth_proxy."""


class RequirerSchema(DataBagSchema):
"""Requirer schema for auth_proxy."""

app: AuthProxyRequirer
ProviderAppData = None
ProviderUnitData = None
RequirerUnitData = None
25 changes: 6 additions & 19 deletions interfaces/forward_auth/interface/v0/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,26 @@
# See LICENSE file for licensing details.
"""This file defines the schemas for the provider and requirer sides.

It exposes two interfaces.schema_base.DataBagSchema subclasses called:
- ProviderSchema
- RequirerSchema

Examples:
ProviderSchema:
Provider:
unit: <empty>
app: {
"decisions_address": "https://oauth2-proxy-k8s-0.oauth2-proxy-k8s.namespace.svc.cluster.local",
"app_names": ["charmed-app", "other-charmed-app"],
"headers": ["X-User", "X-Some-Header"]
}

RequirerSchema:
Requirer:
unit: <empty>
app: {
"ingress_app_names": ["charmed-app", "other-charmed-app"]
}
"""

from interface_tester.schema_base import DataBagSchema
from pydantic import BaseModel, Field


class ForwardAuthProvider(BaseModel):
class ProviderAppData(BaseModel):
"""ForwardAuthProvider model."""

decisions_address: str = Field(description='The internal decisions endpoint address.')
Expand All @@ -44,21 +39,13 @@ class ForwardAuthProvider(BaseModel):
)


class ForwardAuthRequirer(BaseModel):
class RequirerAppData(BaseModel):
"""ForwardAuthRequirer model."""

ingress_app_names: list[str] = Field(
description='List of names of applications that are related via ingress.'
)


class ProviderSchema(DataBagSchema):
"""Provider schema for forward_auth."""

app: ForwardAuthProvider


class RequirerSchema(DataBagSchema):
"""Requirer schema for forward_auth."""

app: ForwardAuthRequirer
ProviderUnitData = None
RequirerUnitData = None
62 changes: 7 additions & 55 deletions interfaces/kratos_external_idp/interface/v0/schema.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
"""This file defines the schemas for the provider and requirer sides of the kratos_external_idp interface.

It exposes two interfaces.schema_base.DataBagSchema subclasses called:
- ProviderSchema
- RequirerSchema
It defines models `ProviderAppData` and `RequirerAppData`.

Examples:
ProviderSchema:
Provider:
unit: <empty>
app: {
"providers":[
Expand All @@ -17,7 +15,7 @@
]
}

RequirerSchema:
Requirer:
unit: <empty>
app: {
"providers": [
Expand All @@ -30,7 +28,6 @@
import textwrap
from enum import Enum

from interface_tester.schema_base import DataBagSchema
from pydantic import AnyHttpUrl, BaseModel, Field, field_validator


Expand Down Expand Up @@ -129,63 +126,18 @@ def issuer_url_allowed(cls, v, info):
return v


class KratosExternalIdpProviderData(BaseModel):
class ProviderAppAData(BaseModel):
providers: list[ExternalIdpProvider]


class ProviderSchema(DataBagSchema):
"""Provider schema for KratosExternalIdp.
This relation interface can be used to provide a set of client configurations to Kratos to connect with external providers.
"""

app: KratosExternalIdpProviderData

class Config:
schema_extra = {
"example": {
"unit": None,
"app": {
"providers": [
{
"client_id": "client_id",
"client_secret": "cl1ent-s3cRet",
"secret_backend": "relation",
"tenant_id": "4242424242424242",
"provider": "microsoft",
}
]
},
}
}


class ExternalIdpRequirer(BaseModel):
redirect_uri: Url
provider_id: str


class KratosExternalIdpRequirerData(BaseModel):
class RequirerAppData(BaseModel):
providers: list[ExternalIdpRequirer]


class RequirerSchema(DataBagSchema):
"""Requirer schema for KratosExternalIdp.
This relation interface can be used from Kratos to provide the redirect_uri of a client that will be used with an external provider.
"""

app: KratosExternalIdpRequirerData

class Config:
schema_extra = {
"example": {
"unit": None,
"app": {
"providers": [
{
"redirect_uri": "https://example.kratos.com/self-service/methods/oidc/callback/microsoft",
"provider_id": "microsoft",
}
]
},
}
}
ProviderUnitData = None
RequirerUnitData = None
21 changes: 5 additions & 16 deletions interfaces/kratos_info/interface/v0/schema.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
"""This file defines the schemas for the provider and requirer sides of this relation interface.
"""This file defines the schemas for the provider and requirer sides of this relation interface."""

It must expose two interfaces.schema_base.DataBagSchema subclasses called:
- ProviderSchema
- RequirerSchema
"""

from interface_tester.schema_base import DataBagSchema
from pydantic import AnyHttpUrl, BaseModel, Field


class KratosInfoProvider(BaseModel):
class ProviderAppData(BaseModel):
admin_endpoint: AnyHttpUrl = Field(description="Kratos admin URL.")
public_endpoint: AnyHttpUrl = Field(description="Kratos public URL.")
login_browser_endpoint: AnyHttpUrl = Field(
Expand All @@ -33,11 +27,6 @@ class KratosInfoProvider(BaseModel):
)


class ProviderSchema(DataBagSchema):
"""The schema for the provider side of this interface."""

app: KratosInfoProvider


class RequirerSchema(DataBagSchema):
"""The schema for the requirer side of this interface."""
ProviderUnitData = None
RequirerAppData = None
RequirerUnitData = None
27 changes: 5 additions & 22 deletions interfaces/ldap/interface/v0/schema.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.

"""LDAP relation schema definitions.
"""LDAP relation schema definitions."""

This file defines the schemas for the provider and requirer sides of this
relation interface.

It must expose two interfaces.schema_base.DataBagSchema subclasses called:
- ProviderSchema
- RequirerSchema
"""

from interface_tester.schema_base import DataBagSchema
from pydantic import AnyUrl, BaseModel, Field


class LdapProviderData(BaseModel):
class ProviderAppData(BaseModel):
"""LDAP provider relation data schema."""

urls: list[AnyUrl] = Field(
Expand Down Expand Up @@ -49,7 +40,7 @@ class LdapProviderData(BaseModel):
)


class LdapRequirerData(BaseModel):
class RequirerAppData(BaseModel):
"""LDAP requirer relation data schema."""

user: str | None = Field(
Expand All @@ -60,13 +51,5 @@ class LdapRequirerData(BaseModel):
)


class ProviderSchema(DataBagSchema):
"""The schema for the provider side of the ldap interface."""

app: LdapProviderData


class RequirerSchema(DataBagSchema):
"""The schema for the requirer side of the ldap interface."""

app: LdapRequirerData
ProviderUnitData = None
RequirerUnitData = None
20 changes: 6 additions & 14 deletions interfaces/login_ui_endpoints/interface/v0/schema.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Copyright 2023 Canonical
# See LICENSE file for licensing details.
"""This file defines the schemas for the provider and requirer sides of the login_ui_endpoints interface.
It exposes two interfaces.schema_base.DataBagSchema subclasses called:
- ProviderSchema
- RequirerSchema

Examples:
ProviderSchema:
Provider:
unit: <empty>
app: {"consent_url": "http://identity-platform-login-ui-url/consent",
"error_url": "http://identity-platform-login-ui-url/error",
Expand All @@ -17,11 +15,10 @@
}
"""

from interface_tester.schema_base import DataBagSchema
from pydantic import BaseModel, Field


class MyProviderAppData(BaseModel):
class ProviderAppData(BaseModel):
consent_url: str = Field(
description="Endpoint Hydra forwards users for consent related operations."
)
Expand All @@ -39,11 +36,6 @@ class MyProviderAppData(BaseModel):
default_url: str = Field(description="Default Browser endpoint Kratos forwards users to.")


class ProviderSchema(DataBagSchema):
"""Provider schema for login_ui_endpoints."""

app: MyProviderAppData


class RequirerSchema(DataBagSchema):
"""Requirer schema for login_ui_endpoints."""
ProviderUnitData = None
RequirerAppData = None
RequirerUnitData = None
35 changes: 0 additions & 35 deletions interfaces/openfga/interface/v0/tests/test_provider.py

This file was deleted.

Loading
Loading