-
Notifications
You must be signed in to change notification settings - Fork 42
feat: Add casbin as AuthZ provider option #908
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
20f7601
feat: introduce Casbin as AuthZ provider option
ayushjain17 dfbf066
fix: some fixes
ayushjain17 eb59ce7
chore: addressing comments
ayushjain17 84a5a29
chore: addressing comments
ayushjain17 dc9f4df
fix: adding non empty check
ayushjain17 572d3b6
chore: addressing comments
ayushjain17 f6da953
chore: addressing comments
ayushjain17 d5e7e7c
chore: addressing comments
ayushjain17 a0820db
chore: addressing comments
ayushjain17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| DATABASE_URL=postgres://postgres:docker@localhost:5432/config?sslmode=disable # Sample format (unused ENV variable) | ||
| PORT=8080 | ||
| # CASBIN_DATABASE_URL=postgres://postgres:docker@localhost:5432/config?sslmode=disable # Sample format (unused ENV variable) | ||
| RUST_LOG=debug | ||
| AWS_ACCESS_KEY_ID=test | ||
| AWS_SECRET_ACCESS_KEY=test | ||
|
|
@@ -36,6 +37,15 @@ AUTH_PROVIDER=DISABLED | |
| # OIDC_ORG_TOKEN_ENDPOINT_FORMAT="http://localhost:8081/realms/<organisation>/protocol/openid-connect/token" | ||
| # OIDC_ORG_ISSUER_ENDPOINT_FORMAT="http://localhost:8081/realms/<organisation>" | ||
| AUTH_Z_PROVIDER=DISABLED | ||
| ### Env(s) for Casbin AuthZ | ||
| # AUTH_Z_PROVIDER=CASBIN | ||
| # CASBIN_DB_USER=postgres | ||
| # CASBIN_DB_PASSWORD=docker | ||
| # CASBIN_DB_HOST=localhost:5432 | ||
| # CASBIN_DB_NAME=config | ||
| # CASBIN_DB_POOL_SIZE=3 | ||
| # CASBIN_POLICY_REFRESH_INTERVAL=60 # in seconds, default is 60 seconds | ||
| # ROOT_ADMIN_EMAIL=user@superposition.io | ||
|
Comment on lines
+40
to
+48
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need a follow up PR documenting the casbin setup in docusaurus |
||
| WORKER_ID=1 | ||
| # MASTER_ENCRYPTION_KEY - add this for enabling secrets in local | ||
| REDIS_URL="http://localhost:6379" | ||
|
|
@@ -50,7 +60,8 @@ REDIS_KEY_TTL=604800 | |
| # | ||
| # DB_PASSWORD | ||
| # SUPERPOSITION_TOKEN | ||
| # OIDC_CLIENT_SECRET - if using OIDC as auth provider | ||
| # OIDC_CLIENT_SECRET - if using OIDC as authn provider | ||
| # CASBIN_DB_PASSWORD - if using CASBIN as authz provider | ||
| # MASTER_ENCRYPTION_KEY - for using secrets | ||
| # PREVIOUS_MASTER_ENCRYPTION_KEY - needed for rotating secrets | ||
| # | ||
|
|
@@ -59,4 +70,4 @@ REDIS_KEY_TTL=604800 | |
| # | ||
| ## for local development, they already have a default value, | ||
| ## to override, you can set them directly in .env file | ||
| ################################################# | ||
| ################################################# | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: juspay/superposition
Length of output: 1032
🏁 Script executed:
sed -n '375,450p' crates/service_utils/src/middlewares/auth_z/casbin.rsRepository: juspay/superposition
Length of output: 2608
🏁 Script executed:
rg -n 'fn get_database_url' crates/service_utils/src/middlewares/auth_z/Repository: juspay/superposition
Length of output: 46
🏁 Script executed:
rg -n 'fn get_database_url' --type rustRepository: juspay/superposition
Length of output: 134
🏁 Script executed:
sed -n '36,100p' crates/service_utils/src/db/utils.rsRepository: juspay/superposition
Length of output: 1516
Remove
CASBIN_DATABASE_URLfrom line 3.The code uses individual
CASBIN_DB_USER,CASBIN_DB_PASSWORD,CASBIN_DB_HOST, andCASBIN_DB_NAMEenvironment variables (constructed viaget_database_url()incrates/service_utils/src/db/utils.rs).CASBIN_DATABASE_URLhas no consumers in the codebase and is already labeled as unused; remove it to prevent deployment confusion.🤖 Prompt for AI Agents