agenta 0.27.5a1__py3-none-any.whl → 0.27.6a0__py3-none-any.whl
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.
Potentially problematic release.
This version of agenta might be problematic. Click here for more details.
- agenta/sdk/middleware/auth.py +10 -16
- {agenta-0.27.5a1.dist-info → agenta-0.27.6a0.dist-info}/METADATA +1 -1
- {agenta-0.27.5a1.dist-info → agenta-0.27.6a0.dist-info}/RECORD +5 -5
- {agenta-0.27.5a1.dist-info → agenta-0.27.6a0.dist-info}/WHEEL +0 -0
- {agenta-0.27.5a1.dist-info → agenta-0.27.6a0.dist-info}/entry_points.txt +0 -0
agenta/sdk/middleware/auth.py
CHANGED
|
@@ -21,12 +21,6 @@ AGENTA_SDK_AUTH_CACHE_TTL = environ.get(
|
|
|
21
21
|
15 * 60, # 15 minutes
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
-
AGENTA_SDK_AUTH_CACHE = str(environ.get("AGENTA_SDK_AUTH_CACHE", True)).lower() in (
|
|
25
|
-
"true",
|
|
26
|
-
"1",
|
|
27
|
-
"t",
|
|
28
|
-
)
|
|
29
|
-
|
|
30
24
|
AGENTA_UNAUTHORIZED_EXECUTION_ALLOWED = str(
|
|
31
25
|
environ.get("AGENTA_UNAUTHORIZED_EXECUTION_ALLOWED", False)
|
|
32
26
|
).lower() in ("true", "1", "t")
|
|
@@ -95,11 +89,9 @@ class AuthorizationMiddleware(BaseHTTPMiddleware):
|
|
|
95
89
|
sort_keys=True,
|
|
96
90
|
)
|
|
97
91
|
|
|
98
|
-
|
|
99
|
-
if AGENTA_SDK_AUTH_CACHE:
|
|
100
|
-
policy = cache.get(_hash)
|
|
92
|
+
cached_policy = cache.get(_hash)
|
|
101
93
|
|
|
102
|
-
if not
|
|
94
|
+
if not cached_policy:
|
|
103
95
|
async with httpx.AsyncClient() as client:
|
|
104
96
|
response = await client.get(
|
|
105
97
|
f"{self.host}/api/permissions/verify",
|
|
@@ -109,26 +101,28 @@ class AuthorizationMiddleware(BaseHTTPMiddleware):
|
|
|
109
101
|
)
|
|
110
102
|
|
|
111
103
|
if response.status_code != 200:
|
|
112
|
-
cache.put(_hash, {"effect": "deny"})
|
|
104
|
+
# cache.put(_hash, {"effect": "deny"})
|
|
113
105
|
return Deny()
|
|
114
106
|
|
|
115
107
|
auth = response.json()
|
|
116
108
|
|
|
117
109
|
if auth.get("effect") != "allow":
|
|
118
|
-
cache.put(_hash, {"effect": "deny"})
|
|
110
|
+
# cache.put(_hash, {"effect": "deny"})
|
|
119
111
|
return Deny()
|
|
120
112
|
|
|
121
|
-
|
|
113
|
+
cached_policy = {
|
|
122
114
|
"effect": "allow",
|
|
123
115
|
"credentials": auth.get("credentials"),
|
|
124
116
|
}
|
|
125
117
|
|
|
126
|
-
cache.put(_hash,
|
|
118
|
+
# cache.put(_hash, cached_policy)
|
|
127
119
|
|
|
128
|
-
if
|
|
120
|
+
if cached_policy.get("effect") == "deny":
|
|
129
121
|
return Deny()
|
|
130
122
|
|
|
131
|
-
request.state.credentials =
|
|
123
|
+
request.state.credentials = cached_policy.get("credentials")
|
|
124
|
+
|
|
125
|
+
print(f"credentials: {request.state.credentials}")
|
|
132
126
|
|
|
133
127
|
return await call_next(request)
|
|
134
128
|
|
|
@@ -157,7 +157,7 @@ agenta/sdk/managers/deployment.py,sha256=SEokjZeh6n7HRKZ92Y0WncdG49hIFx-Z3B3HAl2
|
|
|
157
157
|
agenta/sdk/managers/shared.py,sha256=e53jckQq5PIMpjdxADOonUj7o8aGfzmSvdeH5f43rGs,21497
|
|
158
158
|
agenta/sdk/managers/variant.py,sha256=A5ga3mq3b0weUTXa9HO72MGaspthGcu1uK9K5OnP738,4172
|
|
159
159
|
agenta/sdk/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
160
|
-
agenta/sdk/middleware/auth.py,sha256=
|
|
160
|
+
agenta/sdk/middleware/auth.py,sha256=8f05yOVpTFYpbqZSGkXU_9sWA6yK4qxiDfdtZS16n0E,4005
|
|
161
161
|
agenta/sdk/middleware/cache.py,sha256=C_LEzFbulbCBIKtcut2T4qJzh90q4369WCsApDg3Vm0,902
|
|
162
162
|
agenta/sdk/router.py,sha256=mOguvtOwl2wmyAgOuWTsf98pQwpNiUILKIo67W_hR3A,119
|
|
163
163
|
agenta/sdk/tracing/__init__.py,sha256=rQNe5-zT5Kt7_CDhq-lnUIi1EYTBVzVf_MbfcIxVD98,41
|
|
@@ -193,7 +193,7 @@ agenta/templates/simple_prompt/app.py,sha256=kODgF6lhzsaJPdgL5b21bUki6jkvqjWZzWR
|
|
|
193
193
|
agenta/templates/simple_prompt/env.example,sha256=g9AE5bYcGPpxawXMJ96gh8oenEPCHTabsiOnfQo3c5k,70
|
|
194
194
|
agenta/templates/simple_prompt/requirements.txt,sha256=ywRglRy7pPkw8bljmMEJJ4aOOQKrt9FGKULZ-DGkoBU,23
|
|
195
195
|
agenta/templates/simple_prompt/template.toml,sha256=DQBtRrF4GU8LBEXOZ-GGuINXMQDKGTEG5y37tnvIUIE,60
|
|
196
|
-
agenta-0.27.
|
|
197
|
-
agenta-0.27.
|
|
198
|
-
agenta-0.27.
|
|
199
|
-
agenta-0.27.
|
|
196
|
+
agenta-0.27.6a0.dist-info/METADATA,sha256=wBW4ey0so5ccuqLLROm00KZ9hyowi504N8H75IXg4c8,31619
|
|
197
|
+
agenta-0.27.6a0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
198
|
+
agenta-0.27.6a0.dist-info/entry_points.txt,sha256=PDiu8_8AsL7ibU9v4iNoOKR1S7F2rdxjlEprjM9QOgo,46
|
|
199
|
+
agenta-0.27.6a0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|