ragflow/api/apps
yurhett 9c6c6c51e0
Fix: use jwks_uri from OIDC metadata for JWKS client (#8136)
### What problem does this PR solve?
Issue: #8051

The current implementation assumes JWKS endpoints follow the standard
`/.well-known/jwks.json` convention. This breaks authentication for OIDC
providers that use non-standard JWKS paths, resulting in 404 errors
during token validation.

Root Cause Analysis
- The OpenID Connect specification doesn't mandate a fixed path for JWKS
endpoints
- Some identity providers (like certain Keycloak configurations) use
custom endpoints
- Our previous approach constructed JWKS URLs by convention rather than
discovery

### Solution Approach
Instead of constructing JWKS URLs by appending to the issuer URI, we
now:
1. Properly leverage the `jwks_uri` from the OIDC discovery metadata
2. Honor the identity provider's actual configured endpoint

```python
# Before (fragile approach)
jwks_url = f"{self.issuer}/.well-known/jwks.json"

# After (standards-compliant)
jwks_cli = jwt.PyJWKClient(self.jwks_uri)  # Use discovered endpoint
```

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-06-10 10:16:58 +08:00
..
auth Fix: use jwks_uri from OIDC metadata for JWKS client (#8136) 2025-06-10 10:16:58 +08:00
sdk Refa: dataset operations to simplify error handling (#8132) 2025-06-09 13:29:56 +08:00
__init__.py Fix: Authentication Bypass via predictable JWT secret and empty token validation (#7998) 2025-06-05 12:10:24 +08:00
api_app.py fix: resolve “has no attribute 'max_length'” error in keyword_extraction (#7903) 2025-05-28 10:58:06 +08:00
canvas_app.py Fix:Agent running message i10n (#7635) 2025-05-14 14:27:12 +08:00
chunk_app.py Feat: When Delete Chunk Will Also Delete Chunk Related Image (#7656) 2025-05-15 11:53:47 +08:00
conversation_app.py Fix: /v1/conversation/completion KeyError: 'conversation_id' (#8037) 2025-06-04 10:18:14 +08:00
dialog_app.py Fix: no kb selected for an assistant. (#8021) 2025-06-03 17:42:16 +08:00
document_app.py Feat: repair corrupted PDF files on upload automatically (#7693) 2025-05-19 14:54:06 +08:00
file2document_app.py Fix: link to KB from filemanager. (#6530) 2025-03-26 09:41:14 +08:00
file_app.py fix: After the file is deleted, it still remains in the bucket. (#7482) 2025-05-06 19:30:42 +08:00
kb_app.py Update upload filename length limit from 128 to 256, which is aligned with os (#7971) 2025-05-30 14:25:59 +08:00
langfuse_app.py Feat: add project_id and project_name to Langfuse API (#6481) 2025-03-25 10:36:34 +08:00
llm_app.py Fix: Hunyuan model adding error. (#6531) 2025-03-26 10:33:33 +08:00
plugin_app.py Feat: Support tool calling in Generate component (#7572) 2025-05-16 16:32:19 +08:00
system_app.py Feat: Add user registration toggle feature (#6327) 2025-03-21 09:38:15 +08:00
tenant_app.py Update team invite message (#4085) 2024-12-18 14:20:09 +08:00
user_app.py Fix: Authentication Bypass via predictable JWT secret and empty token validation (#7998) 2025-06-05 12:10:24 +08:00