Skip to content

Commit 8f07eb7

Browse files
committed
Simplify app by removing concept of client id & secret
1 parent 9cbce61 commit 8f07eb7

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

docker-compose.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ services:
6161
build:
6262
context: ./examples/mock_oidc_server
6363
environment:
64-
CLIENT_ID: stac
65-
CLIENT_SECRET: secret
66-
REDIRECT_URI: http://localhost:8000/docs/oauth2-redirect
6764
ISSUER: http://localhost:8888
6865
SCOPES: item:create,item:update,item:delete,collection:create,collection:update,collection:delete
6966
PORT: 8888

examples/mock_oidc_server/app.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@
3737
)
3838

3939
# Configuration
40-
CLIENT_ID = os.environ.get("CLIENT_ID", "stac")
41-
CLIENT_SECRET = os.environ.get("CLIENT_SECRET", "secret")
42-
REDIRECT_URI = os.environ.get(
43-
"REDIRECT_URI", "http://localhost:8000/docs/oauth2-redirect"
44-
)
4540
ISSUER = os.environ.get("ISSUER", "http://localhost:3000")
4641
AVAILABLE_SCOPES = os.environ.get("SCOPES", "")
4742
KEY_ID = "1"
@@ -110,15 +105,6 @@ def int_to_base64url(value):
110105
access_tokens = {}
111106
auth_requests = {}
112107

113-
# Mock client registry
114-
CLIENT_REGISTRY = {
115-
CLIENT_ID: {
116-
"client_secret": CLIENT_SECRET,
117-
"redirect_uris": [REDIRECT_URI],
118-
"grant_types": ["authorization_code"],
119-
}
120-
}
121-
122108

123109
@app.get("/")
124110
async def root():
@@ -167,14 +153,6 @@ async def authorize(
167153
if response_type != "code":
168154
raise HTTPException(status_code=400, detail="Invalid response type")
169155

170-
# Validate client
171-
if client_id not in CLIENT_REGISTRY:
172-
raise HTTPException(status_code=400, detail="Invalid client_id")
173-
174-
# Validate redirect URI
175-
if redirect_uri not in CLIENT_REGISTRY[client_id]["redirect_uris"]:
176-
raise HTTPException(status_code=400, detail="Invalid redirect_uri")
177-
178156
# Validate PKCE if provided
179157
if code_challenge is not None:
180158
if code_challenge_method != "S256":
@@ -277,13 +255,6 @@ async def token(
277255

278256
if computed_challenge != code_challenge:
279257
raise HTTPException(status_code=400, detail="Invalid code verifier")
280-
else:
281-
# If not PKCE, verify client secret
282-
if not client_secret:
283-
raise HTTPException(status_code=400, detail="Client secret required")
284-
285-
if client_secret != CLIENT_REGISTRY[client_id]["client_secret"]:
286-
raise HTTPException(status_code=400, detail="Invalid client secret")
287258

288259
# Clean up the used code and PKCE challenge
289260
del authorization_codes[code]

0 commit comments

Comments
 (0)