-
Notifications
You must be signed in to change notification settings - Fork 154
feat(jans-auth-server): introducing interception script for tx_tokens #8376 #12596
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
base: main
Are you sure you want to change the base?
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughYou better think twice! Like a wise ol' pigeon droppin' knowledge from up high, I got the scoop on this PR. WalkthroughAdds TX token interception support: new TxTokenType API and DummyTxTokenType, TX_TOKEN enum entry, ExternalTxTokenService to run scripts, and integration in TxTokenService to let external scripts modify payloads, responses, and token lifetime (with 403 on script denial). Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
…oad modification and response modification #8376
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
jans-auth-server/server/src/main/java/io/jans/as/server/service/external/ExternalTxTokenService.java(1 hunks)jans-auth-server/server/src/main/java/io/jans/as/server/token/ws/rs/TxTokenService.java(7 hunks)jans-core/script/src/main/java/io/jans/model/custom/script/CustomScriptType.java(1 hunks)jans-core/script/src/main/java/io/jans/model/custom/script/type/token/DummyTxTokenType.java(1 hunks)jans-core/script/src/main/java/io/jans/model/custom/script/type/token/TxTokenType.java(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
jans-core/script/src/main/java/io/jans/model/custom/script/type/token/DummyTxTokenType.java (1)
terraform-provider-jans/jans/script.go (1)
SimpleCustomProperty(25-29)
jans-auth-server/server/src/main/java/io/jans/as/server/service/external/ExternalTxTokenService.java (2)
jans-auth-server/server/src/main/java/io/jans/as/server/model/common/ExecutionContext.java (1)
ExecutionContext(35-483)jans-link/service/src/main/java/io/jans/link/external/ExternalScriptService.java (1)
ExternalScriptService(38-186)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: prep-matrix
- GitHub Check: run-tests (MYSQL)
- GitHub Check: run-tests (PGSQL)
- GitHub Check: sonar scan (jans-auth-server)
...h-server/server/src/main/java/io/jans/as/server/service/external/ExternalTxTokenService.java
Show resolved
Hide resolved
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
♻️ Duplicate comments (1)
jans-auth-server/server/src/main/java/io/jans/as/server/service/external/ExternalTxTokenService.java (1)
46-60: Past issue resolved—empty-script path now succeeds.If ya skip the good vibes, I'll say, 'You better think twice!' The past review flagged line 49 for returning
falsewhen no scripts are found, but I'm spotting that it now hands backtrue—exactly right! The default TX token flow can cruise through when scripts ain't configured. I'm ready to have some fun!
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
jans-auth-server/server/src/main/java/io/jans/as/server/service/external/ExternalParService.java(1 hunks)jans-auth-server/server/src/main/java/io/jans/as/server/service/external/ExternalTxTokenService.java(1 hunks)jans-auth-server/server/src/main/java/io/jans/as/server/service/external/ExternalUpdateTokenService.java(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
jans-auth-server/server/src/main/java/io/jans/as/server/service/external/ExternalTxTokenService.java (2)
jans-auth-server/server/src/main/java/io/jans/as/server/model/common/ExecutionContext.java (1)
ExecutionContext(35-483)jans-link/service/src/main/java/io/jans/link/external/ExternalScriptService.java (1)
ExternalScriptService(38-186)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: run-tests (MYSQL)
- GitHub Check: prep-matrix
- GitHub Check: run-tests (PGSQL)
- GitHub Check: sonar scan (jans-auth-server)
🔇 Additional comments (6)
jans-auth-server/server/src/main/java/io/jans/as/server/service/external/ExternalParService.java (1)
49-63: LGTM! No-script path now succeeds as expected.Listen up, my friend! Like a wise ol' pigeon, I'm spotting that when no PAR scripts are configured, this method now hands back
trueinstead of blocking the flow. This lets the default PAR behavior cruise right through when scripts ain't present—exactly what we need! Let's get this party rollin'!jans-auth-server/server/src/main/java/io/jans/as/server/service/external/ExternalUpdateTokenService.java (1)
58-72: LGTM! Empty-script handling now succeeds.You better think twice before blocking token updates when no scripts are around! This change hands back
truewhen the script basket is empty, so the ID token flow keeps cruisin' with built-in behavior. I'm ready to have some fun with this consistent pattern across all external services!jans-auth-server/server/src/main/java/io/jans/as/server/service/external/ExternalTxTokenService.java (4)
21-44: LGTM! Constructor and per-script method look solid.Listen up, my friend! This TX token service constructor and the per-script
modifyTokenPayloadmethod follow the wise ol' pigeon pattern we've been using. Script execution, error handling, and WebApplicationException propagation are all cruisin' smoothly. Let's get this party rollin'!
62-99: LGTM! Response modification methods follow the pattern.Like a wise ol' pigeon, I'm spotting that both the per-script and aggregate
modifyResponsemethods follow the same solid pattern asmodifyTokenPayload. Empty-script handling returnstrue(line 87), error handling is tight, and that extra trace log at line 86 is a nice touch. Let's get this party rollin'!
101-136: LGTM! Lifetime methods handle empty scripts appropriately.Listen up, my friend! The
getTxTokenLifetimeInSecondsmethods follow the pattern, but rightly return0when scripts are empty (line 124) instead of boolean—that's the ticket for integer lifetimes! The loop grabs the first positive lifetime, and the fallback to0signals "use default." I'm ready to have some fun with this logic!
139-152: LGTM! Script retrieval logic is safe and sound.You better think twice before calling
getClient()without checking! This helper properly guards against null clients at line 140 before dereferencing at line 145. The DNS-based script lookup matches the pattern in PAR and UpdateToken services. Let's get this party rollin'!



Description
feat(jans-auth-server): introducing interception script for tx_tokens
Target issue
closes #8376
Test and Document the changes
Please check the below before submitting your PR. The PR will not be merged if there are no commits that start with
docs:to indicate documentation changes or if the below checklist is not selected.Summary by CodeRabbit
New Features
Bug Fixes