-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update to make this work for both local openid and keycloak again #2197
Conversation
Warning Rate limit exceeded@burnettk has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 31 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
📝 Walkthrough📝 Walkthrough📝 WalkthroughWalkthroughThe pull request modifies the Changes
Sequence DiagramsequenceDiagram
participant Script as get_token Script
participant Keycloak as Keycloak Server
Script->>Script: Set default realm_name
Script->>Script: Construct token URL
alt URL contains "/realms"
Script->>Keycloak: Request token without realm name
else
Script->>Keycloak: Request token with realm name
end
Keycloak-->>Script: Return token
The sequence diagram illustrates the updated token retrieval process, showing how the script now dynamically constructs the token URL based on the Keycloak base URL structure. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
spiffworkflow-backend/bin/get_token (1)
41-45
: Improve error handling and URL validationThe URL construction logic is more flexible now, but could benefit from additional safeguards:
- URL validation
- Error handling for malformed URLs
- Logging for debugging purposes
Consider applying these improvements:
token_path = "/protocol/openid-connect/token" +# Validate keycloak_base_url is a valid URL +if keycloak_base_url and not keycloak_base_url.startswith(('http://', 'https://')): + raise ValueError(f"Invalid keycloak_base_url: {keycloak_base_url}") + if "/realms" in keycloak_base_url: openid_token_url = f"{keycloak_base_url}{token_path}" else: openid_token_url = f"{keycloak_base_url}/realms/{realm_name}{token_path}" + +# Log the constructed URL for debugging (consider using proper logging) +print(f"Using OpenID token URL: {openid_token_url}", file=sys.stderr)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
spiffworkflow-backend/bin/get_token
(2 hunks)
🔇 Additional comments (2)
spiffworkflow-backend/bin/get_token (2)
22-22
: Verify the impact of realm name change
The default realm name has changed from "spiffworkflow" to "spiffworkflow-local". While this aligns with the PR objective, it could affect existing configurations.
Line range hint 1-85
: Verify documentation updates
The authentication flow changes might need to be reflected in the documentation.
✅ Verification successful
Documentation is consistent with authentication changes
The documentation and related scripts are already aligned with the authentication flow changes:
- README.md includes Keycloak setup instructions and authentication options
- PyCharm docs cover both built-in and Keycloak authentication configurations
- Related scripts (
run_process_model_with_api
,login_with_user_list
,add_test_users_to_keycloak
) use consistent environment variables and realm handling
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for related documentation that might need updating
# Look for documentation files
fd -e md -e rst | xargs rg -l -i "realm|keycloak|openid|authentication"
# Check for configuration examples
fd "config|example" -e yaml -e env | xargs rg -l "KEYCLOAK_BASE_URL|OPENID_TOKEN_URL"
Length of output: 648
Script:
#!/bin/bash
# Check content of relevant documentation files for authentication details
echo "=== README.md ==="
rg -A 5 -B 5 -i "authentication|keycloak|realm" README.md || true
echo -e "\n=== spiffworkflow-backend/docs/pycharm.md ==="
rg -A 5 -B 5 -i "authentication|keycloak|realm" spiffworkflow-backend/docs/pycharm.md || true
echo -e "\n=== Related environment variables in documentation ==="
rg -A 2 "KEYCLOAK_BASE_URL|OPENID_TOKEN_URL" docs/ spiffworkflow-backend/docs/ || true
echo -e "\n=== Check other scripts using similar authentication configuration ==="
for file in spiffworkflow-backend/bin/run_process_model_with_api spiffworkflow-backend/bin/login_with_user_list spiffworkflow-backend/keycloak/bin/add_test_users_to_keycloak; do
echo -e "\n=== $file ==="
rg "KEYCLOAK_BASE_URL|OPENID_TOKEN_URL|realm_name" "$file" || true
done
Length of output: 5363
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary by CodeRabbit
New Features
Bug Fixes