You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking for a good "first PR/contribution" to contribute back to the KeyCloak community, and since my organization very heavily depends on the SAML JavaScript Attribute Mapper ScriptBasedMapper.java, I was looking to see if I could evaluate, write or improve tests, and possibly someday in the future contribute to the JDK17 transition (e.g. #9945)...
I'm seeking guidance (or feedback) regarding adding new tests in KeyCloak. More unit testing is always better... right?
My question is - where should this test be located, and are there any similar tests (for example, with the OIDC Script mapper) that I might use as a starting point?
I'm still getting familiar with the beautiful, but large, KeyCloak codebase, so guidance would be quite appreciated.
After a bit of time digging, my best guess is making tests that mimic or work in a similar manner to a combination of the following:
While researching this, I noticed the following naming conventions within the Keycloak codebase (which may be helpful for someone else at some point!)
js or script refers to running JavaScript inside the JVM via Nashorn, either as a Protocol Mapper or an Authorization
javascript refers to either the recently deprecated node.js adapter or running browser based JavaScript via Selenium WebDriver
Background ... why ScriptBasedMapper.java?
Issue #9945 references the JavaScript Authorization Provider (and a related test case, org.keycloak.testsuite.authz.AuthorizationTest) related to the Nashorn JavaScript engine being removed in JDK17.
After looking for any test cases for services/src/main/java/org/keycloak/protocol/saml/mappers/ScriptBasedMapper.java, I ended up digging through the git repository history to find this massive commit from 2019: 8a750c7 which deleted several (seemingly) important tests without corresponding replacements, including the only test available for the ScriptBasedMapper.java class 😱.
The commit description is extremely brief (*ahem*Commit messages and issue linking), with only the subject: "KEYCLOAK-6750 Adapt Tomcat adapter tests to new structure".
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm looking for a good "first PR/contribution" to contribute back to the KeyCloak community, and since my organization very heavily depends on the SAML JavaScript Attribute Mapper
ScriptBasedMapper.java, I was looking to see if I could evaluate, write or improve tests, and possibly someday in the future contribute to the JDK17 transition (e.g. #9945)...I'm seeking guidance (or feedback) regarding adding new tests in KeyCloak. More unit testing is always better... right?
I would like to add some tests for the SAML services/src/main/java/org/keycloak/protocol/saml/mappers/ScriptBasedMapper.java class - since there are none 🧐
My question is - where should this test be located, and are there any similar tests (for example, with the OIDC Script mapper) that I might use as a starting point?
I'm still getting familiar with the beautiful, but large, KeyCloak codebase, so guidance would be quite appreciated.
After a bit of time digging, my best guess is making tests that mimic or work in a similar manner to a combination of the following:
While researching this, I noticed the following naming conventions within the Keycloak codebase (which may be helpful for someone else at some point!)
jsorscriptrefers to running JavaScript inside the JVM via Nashorn, either as a Protocol Mapper or an Authorizationjavascriptrefers to either the recently deprecated node.js adapter or running browser based JavaScript via Selenium WebDriverBackground ... why ScriptBasedMapper.java?
Issue #9945 references the JavaScript Authorization Provider (and a related test case,
org.keycloak.testsuite.authz.AuthorizationTest) related to the Nashorn JavaScript engine being removed in JDK17.After looking for any test cases for services/src/main/java/org/keycloak/protocol/saml/mappers/ScriptBasedMapper.java, I ended up digging through the git repository history to find this massive commit from 2019: 8a750c7 which deleted several (seemingly) important tests without corresponding replacements, including the only test available for the
ScriptBasedMapper.javaclass 😱.The commit description is extremely brief (
*ahem*Commit messages and issue linking), with only the subject: "KEYCLOAK-6750 Adapt Tomcat adapter tests to new structure".Some Googling led me to issues.redhat.com: KEYCLOAK-6750 - Adapter tests - add/adapt support for tomcat adapter tests... which also is surprisingly brief, with a single Google doc URL in the description... which is private 😢: docs.google.com/document/d/1HIeQCL6ObgLgXICT-R9wpMUoYRCvpXk9N0-grnrWrvw
Hitting a dead end in trying to understand "why", I figured I should try and improve it myself.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions