interloper-api 0.121.0__tar.gz → 0.122.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {interloper_api-0.121.0 → interloper_api-0.122.0}/PKG-INFO +1 -1
- {interloper_api-0.121.0 → interloper_api-0.122.0}/pyproject.toml +1 -1
- {interloper_api-0.121.0 → interloper_api-0.122.0}/pyproject.toml.orig +1 -1
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/admin.py +2 -2
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/auth.py +2 -2
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/oauth.py +28 -19
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/organisations.py +8 -10
- {interloper_api-0.121.0 → interloper_api-0.122.0}/README.md +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/__init__.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/app.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/authorization.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/cli.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/dependencies/__init__.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/dependencies/auth.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/dependencies/rbac.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/dependencies/state.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/notifications/__init__.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/notifications/base.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/notifications/invitations.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/notifications/super_admins.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/__init__.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/agent.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/apps.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/authorization.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/backfills.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/catalog.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/components.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/executions.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/health.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/overview.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/relations.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/runs.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/tokens.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/websocket.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/server.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/utils/__init__.py +0 -0
- {interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/utils/time.py +0 -0
|
@@ -42,7 +42,7 @@ class AdminOrganisationResponse(BaseModel):
|
|
|
42
42
|
|
|
43
43
|
id: UUID
|
|
44
44
|
name: str
|
|
45
|
-
|
|
45
|
+
key: str
|
|
46
46
|
member_count: int
|
|
47
47
|
created_at: datetime | None = None
|
|
48
48
|
deleted_at: datetime | None = None
|
|
@@ -61,7 +61,7 @@ class AdminOrganisationResponse(BaseModel):
|
|
|
61
61
|
return cls(
|
|
62
62
|
id=organisation.id,
|
|
63
63
|
name=organisation.name,
|
|
64
|
-
|
|
64
|
+
key=organisation.key,
|
|
65
65
|
member_count=member_count,
|
|
66
66
|
created_at=organisation.created_at,
|
|
67
67
|
deleted_at=organisation.deleted_at,
|
|
@@ -89,7 +89,7 @@ class MembershipResponse(BaseModel):
|
|
|
89
89
|
|
|
90
90
|
id: UUID
|
|
91
91
|
name: str
|
|
92
|
-
|
|
92
|
+
key: str
|
|
93
93
|
role: str
|
|
94
94
|
|
|
95
95
|
|
|
@@ -128,7 +128,7 @@ class AuthUserResponse(BaseModel):
|
|
|
128
128
|
role = store.members.role_of(organisation.id, profile)
|
|
129
129
|
if role is not None:
|
|
130
130
|
memberships.append(
|
|
131
|
-
MembershipResponse(id=organisation.id, name=organisation.name,
|
|
131
|
+
MembershipResponse(id=organisation.id, name=organisation.name, key=organisation.key, role=role)
|
|
132
132
|
)
|
|
133
133
|
return cls(
|
|
134
134
|
id=profile.id,
|
|
@@ -5,11 +5,13 @@ Providers come from the core registry (``interloper.oauth``): each
|
|
|
5
5
|
the exchange is performed generically — adding a provider is an
|
|
6
6
|
``interloper.oauth_providers`` entry point, not a new route.
|
|
7
7
|
|
|
8
|
-
The in-house *OAuth* credentials (``client_id`` / ``client_secret``
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
The in-house *OAuth* credentials (``client_id`` / ``client_secret``) are read
|
|
9
|
+
from provider-scoped environment variables (``INTERLOPER_<PROVIDER>_CLIENT_ID``, …)
|
|
10
|
+
and used to perform the exchange; the redirect URI is the app's callback page
|
|
11
|
+
for the provider unless ``INTERLOPER_<PROVIDER>_REDIRECT_URI`` overrides it (see
|
|
12
|
+
``OAuthAppCredentials``). The secret is never returned to the browser;
|
|
13
|
+
connections resolve the credentials from the same env at runtime (see
|
|
14
|
+
``OAuthCredentialField``).
|
|
13
15
|
|
|
14
16
|
The ``GET /providers`` endpoint returns metadata for all providers that
|
|
15
17
|
have credentials configured, so the frontend knows which "Sign in with X"
|
|
@@ -27,7 +29,7 @@ from fastapi import APIRouter, HTTPException
|
|
|
27
29
|
from interloper.oauth import PROVIDERS, OAuthAppCredentials
|
|
28
30
|
from pydantic import BaseModel
|
|
29
31
|
|
|
30
|
-
from interloper_api.dependencies import CurrentUserDep
|
|
32
|
+
from interloper_api.dependencies import CurrentUserDep, SettingsDep
|
|
31
33
|
|
|
32
34
|
logger = logging.getLogger(__name__)
|
|
33
35
|
|
|
@@ -35,19 +37,19 @@ router = APIRouter(prefix="/oauth", tags=["oauth"])
|
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
def log_provider_status() -> None:
|
|
38
|
-
"""Log which OAuth providers are usable, warning on partial
|
|
40
|
+
"""Log which OAuth providers are usable, warning on partial configurations.
|
|
39
41
|
|
|
40
|
-
Called at app startup: a provider with
|
|
41
|
-
is invisible everywhere else (it simply isn't
|
|
42
|
-
the one place a typo'd or forgotten variable
|
|
42
|
+
Called at app startup: a provider with some of its env vars set but not
|
|
43
|
+
its client id and secret is invisible everywhere else (it simply isn't
|
|
44
|
+
offered), so this warning is the one place a typo'd or forgotten variable
|
|
45
|
+
surfaces.
|
|
43
46
|
"""
|
|
44
47
|
active = []
|
|
45
48
|
for key in PROVIDERS:
|
|
46
|
-
|
|
47
|
-
missing = [n for n in names.values() if not os.environ.get(n)]
|
|
49
|
+
missing = OAuthAppCredentials.missing(key)
|
|
48
50
|
if not missing:
|
|
49
51
|
active.append(key)
|
|
50
|
-
elif
|
|
52
|
+
elif any(os.environ.get(name) for name in OAuthAppCredentials.env_names(key).values()):
|
|
51
53
|
logger.warning("OAuth provider '%s' is partially configured — missing %s", key, ", ".join(sorted(missing)))
|
|
52
54
|
logger.info("OAuth sign-in providers: %s", ", ".join(sorted(active)) if active else "none configured")
|
|
53
55
|
|
|
@@ -73,12 +75,16 @@ class ProviderInfo(BaseModel):
|
|
|
73
75
|
|
|
74
76
|
|
|
75
77
|
@router.get("/providers")
|
|
76
|
-
def list_providers() -> list[ProviderInfo]:
|
|
78
|
+
def list_providers(settings: SettingsDep) -> list[ProviderInfo]:
|
|
77
79
|
"""Return metadata for all configured OAuth providers.
|
|
78
80
|
|
|
79
|
-
Only registered providers with ``CLIENT_ID
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
Only registered providers with ``CLIENT_ID`` and ``CLIENT_SECRET``
|
|
82
|
+
environment variables set are included. Metadata (auth_url, label,
|
|
83
|
+
icon) comes from the provider registry.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
settings: The settings, whose ``server`` gives the public URL each
|
|
87
|
+
redirect URI defaults under.
|
|
82
88
|
|
|
83
89
|
Returns:
|
|
84
90
|
One entry per configured provider, carrying the public half of its
|
|
@@ -94,7 +100,7 @@ def list_providers() -> list[ProviderInfo]:
|
|
|
94
100
|
icon=spec.icon,
|
|
95
101
|
)
|
|
96
102
|
for key, spec in PROVIDERS.items()
|
|
97
|
-
if (creds := OAuthAppCredentials.from_env(key)) is not None
|
|
103
|
+
if (creds := OAuthAppCredentials.from_env(key, settings.server)) is not None
|
|
98
104
|
]
|
|
99
105
|
|
|
100
106
|
|
|
@@ -103,6 +109,7 @@ async def exchange_authorization_code(
|
|
|
103
109
|
provider: str,
|
|
104
110
|
body: AuthorizationCodeExchangeRequest,
|
|
105
111
|
_user: CurrentUserDep,
|
|
112
|
+
settings: SettingsDep,
|
|
106
113
|
) -> dict[str, Any]:
|
|
107
114
|
"""Exchange an authorization code for tokens. Requires authentication.
|
|
108
115
|
|
|
@@ -116,6 +123,8 @@ async def exchange_authorization_code(
|
|
|
116
123
|
body: The authorization code returned by the provider's consent screen.
|
|
117
124
|
_user: The authenticated caller; the route is gated on a session, the
|
|
118
125
|
identity itself is not used.
|
|
126
|
+
settings: The settings, whose ``server`` gives the public URL the
|
|
127
|
+
redirect URI defaults under.
|
|
119
128
|
|
|
120
129
|
Returns:
|
|
121
130
|
The provider's token response, credentials at the top level.
|
|
@@ -129,7 +138,7 @@ async def exchange_authorization_code(
|
|
|
129
138
|
if spec is None:
|
|
130
139
|
raise HTTPException(status_code=400, detail=f"Unknown OAuth provider: {provider}")
|
|
131
140
|
|
|
132
|
-
config = OAuthAppCredentials.from_env(provider)
|
|
141
|
+
config = OAuthAppCredentials.from_env(provider, settings.server)
|
|
133
142
|
if config is None:
|
|
134
143
|
raise HTTPException(status_code=400, detail=f"OAuth provider {provider} is not configured")
|
|
135
144
|
|
{interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/organisations.py
RENAMED
|
@@ -35,7 +35,7 @@ class OrganisationResponse(BaseModel):
|
|
|
35
35
|
|
|
36
36
|
id: UUID
|
|
37
37
|
name: str
|
|
38
|
-
|
|
38
|
+
key: str
|
|
39
39
|
created_at: datetime | None = None
|
|
40
40
|
|
|
41
41
|
@classmethod
|
|
@@ -48,9 +48,7 @@ class OrganisationResponse(BaseModel):
|
|
|
48
48
|
Returns:
|
|
49
49
|
The response model.
|
|
50
50
|
"""
|
|
51
|
-
return cls(
|
|
52
|
-
id=organisation.id, name=organisation.name, slug=organisation.slug, created_at=organisation.created_at
|
|
53
|
-
)
|
|
51
|
+
return cls(id=organisation.id, name=organisation.name, key=organisation.key, created_at=organisation.created_at)
|
|
54
52
|
|
|
55
53
|
|
|
56
54
|
class CreateOrganisationRequest(BaseModel):
|
|
@@ -60,10 +58,10 @@ class CreateOrganisationRequest(BaseModel):
|
|
|
60
58
|
|
|
61
59
|
|
|
62
60
|
class UpdateOrganisationRequest(BaseModel):
|
|
63
|
-
"""Request body for renaming an organisation or changing its
|
|
61
|
+
"""Request body for renaming an organisation or changing its key; omitted fields stay untouched."""
|
|
64
62
|
|
|
65
63
|
name: str | None = None
|
|
66
|
-
|
|
64
|
+
key: str | None = None
|
|
67
65
|
|
|
68
66
|
|
|
69
67
|
class DeleteOrganisationRequest(BaseModel):
|
|
@@ -171,20 +169,20 @@ def create_organisation(body: CreateOrganisationRequest, user: CurrentUserDep, s
|
|
|
171
169
|
|
|
172
170
|
@org_router.patch("")
|
|
173
171
|
def update_organisation(body: UpdateOrganisationRequest, scope: AdminDep, store: StoreDep) -> OrganisationResponse:
|
|
174
|
-
"""Rename an organisation or change its
|
|
172
|
+
"""Rename an organisation or change its key. Requires its admin role, or super-admin.
|
|
175
173
|
|
|
176
|
-
A
|
|
174
|
+
A key that is taken answers 409 and one that is malformed or reserved 400,
|
|
177
175
|
through the store's errors.
|
|
178
176
|
|
|
179
177
|
Args:
|
|
180
|
-
body: The new name and/or
|
|
178
|
+
body: The new name and/or key.
|
|
181
179
|
scope: The organisation the path names, the caller an admin there.
|
|
182
180
|
store: The database store.
|
|
183
181
|
|
|
184
182
|
Returns:
|
|
185
183
|
The updated organisation.
|
|
186
184
|
"""
|
|
187
|
-
updated = store.organisations.update(scope.organisation.id, name=body.name,
|
|
185
|
+
updated = store.organisations.update(scope.organisation.id, name=body.name, key=body.key)
|
|
188
186
|
return OrganisationResponse.from_organisation(updated)
|
|
189
187
|
|
|
190
188
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/dependencies/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/notifications/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/notifications/invitations.py
RENAMED
|
File without changes
|
{interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/notifications/super_admins.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{interloper_api-0.121.0 → interloper_api-0.122.0}/src/interloper_api/routes/authorization.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|