refactor(sso): drop unreachable code from the Entra ID authenticator - #3225
Open
marevol wants to merge 1 commit into
Open
refactor(sso): drop unreachable code from the Entra ID authenticator#3225marevol wants to merge 1 commit into
marevol wants to merge 1 commit into
Conversation
processMemberOf() is only reachable from its own @odata.nextLink recursion. updateMemberOf() calls processDirectMemberOf() instead, and nothing else in the tree calls either entry point. The two methods are near-identical, which makes them a place where a fix lands in one copy and not the other. The two-argument getParentGroup(user, id) overload has no callers either. Also fix getStateTtl(): its javadoc said milliseconds, but removeExpiredStates compares it against an elapsed time that has already been divided by 1000, so the unit is seconds and the 3600 default is one hour. Long.parseLong was unguarded, so a typo in conf/system.properties failed the login with a NumberFormatException rather than something an operator could act on; it now warns and falls back to the default.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Unreachable code
processMemberOf()(84 lines).updateMemberOf()callsprocessDirectMemberOf(); the onlycall to
processMemberOf()is its own@odata.nextLinkrecursion, and nothing else in the tree—
src/mainorsrc/test— reaches either entry point. The two methods are near-identical, sothey are exactly the shape where a fix lands in one copy and quietly misses the other.
getParentGroup(user, id), the two-argument overload, has no callers.Both removed. The three-argument
getParentGroupandprocessDirectMemberOfare untouched.getStateTtl()Two small corrections:
removeExpiredStatescompares it against an elapsed timethat has already been divided by 1000, so the unit is seconds and the
3600default is onehour, not 3.6.
Long.parseLong(value)was unguarded, so a typo inconf/system.propertiesfailed the loginwith a
NumberFormatExceptionrather than something an operator could act on. It now warns andfalls back to the default, and trims the value.
Tests
EntraIdAuthenticator's unit test class, 2 new tests:test_getStateTtl_defaultsToOneHourInSecondstest_getStateTtl_fallsBackWhenTheConfiguredValueIsNotANumber— errored with aNumberFormatExceptionbefore the change(the whole
org.codelibs.fess.ssopackage)