Skip to content

Commit ca6e223

Browse files
authored
Merge pull request #12 from devonartis/fix/broker-url-undefined
fix: broker_url undefined in code examples (TE-1/TE-2/TE-3)
2 parents 92e519b + eab8459 commit ca6e223

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ delegated = agent_a.delegate(
185185
)
186186

187187
# Validate: delegated token has only partition-7
188-
result = validate(broker_url, delegated.access_token)
188+
result = validate(app.broker_url, delegated.access_token)
189189
print(result.claims.scope) # ['read:data:partition-7']
190190
```
191191

docs/developer-guide.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Always validate the delegated token to confirm the broker actually narrowed it:
137137
```python
138138
from agentwrit import validate
139139

140-
result = validate(broker_url, delegated.access_token)
140+
result = validate(app.broker_url, delegated.access_token)
141141
assert result.valid
142142
assert result.claims.scope == ["read:data:partition-7"]
143143
# partition-8 is NOT in the delegated token
@@ -179,7 +179,7 @@ delegated_ab = agent_a.delegate(
179179

180180
# Hop 2: Use the delegated token to delegate further (raw HTTP)
181181
resp = httpx.post(
182-
f"{broker_url}/v1/delegate",
182+
f"{app.broker_url}/v1/delegate",
183183
json={
184184
"delegate_to": agent_c.agent_id,
185185
"scope": ["read:data:partition-7"],
@@ -259,7 +259,7 @@ For zero-trust enforcement, validate the token with the broker AND check scope:
259259
```python
260260
from agentwrit import validate, scope_is_subset
261261

262-
result = validate(broker_url, agent.access_token)
262+
result = validate(app.broker_url, agent.access_token)
263263
if result.valid and result.claims:
264264
# Token is live — now check scope
265265
if scope_is_subset(required_scope, result.claims.scope):
@@ -351,7 +351,7 @@ If someone sends a fake token to your app, `validate()` handles it gracefully:
351351
```python
352352
from agentwrit import validate
353353

354-
result = validate(broker_url, "completely-fake-not-a-jwt")
354+
result = validate(app.broker_url, "completely-fake-not-a-jwt")
355355
print(result.valid) # False
356356
print(result.error) # "token is invalid or expired"
357357
```
@@ -406,7 +406,7 @@ Same behavior, but uses the app's broker URL and timeout.
406406
### ValidateResult Fields
407407

408408
```python
409-
result = validate(broker_url, agent.access_token)
409+
result = validate(app.broker_url, agent.access_token)
410410

411411
if result.valid:
412412
print(result.claims.iss) # "agentwrit"

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Before trusting a token, ask the broker if it's still valid:
115115
```python
116116
from agentwrit import validate
117117

118-
result = validate(broker_url, agent.access_token)
118+
result = validate(app.broker_url, agent.access_token)
119119

120120
if result.valid:
121121
print(f"Subject: {result.claims.sub}") # SPIFFE ID

0 commit comments

Comments
 (0)