Skip to content

refactor(sso): drop unreachable code from the Entra ID authenticator - #3225

Open
marevol wants to merge 1 commit into
masterfrom
entraid-remove-dead-code
Open

refactor(sso): drop unreachable code from the Entra ID authenticator#3225
marevol wants to merge 1 commit into
masterfrom
entraid-remove-dead-code

Conversation

@marevol

@marevol marevol commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Unreachable code

processMemberOf() (84 lines). updateMemberOf() calls processDirectMemberOf(); the only
call to processMemberOf() is its own @odata.nextLink recursion, and nothing else in the tree
src/main or src/test — reaches either entry point. The two methods are near-identical, so
they 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 getParentGroup and processDirectMemberOf are untouched.

getStateTtl()

Two small corrections:

  • The javadoc said "in milliseconds". 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, not 3.6.
  • Long.parseLong(value) 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, and trims the value.

Tests

EntraIdAuthenticator's unit test class, 2 new tests:

  • test_getStateTtl_defaultsToOneHourInSeconds
  • test_getStateTtl_fallsBackWhenTheConfiguredValueIsNotANumber — errored with a
    NumberFormatException before the change
Tests run: 133, Failures: 0, Errors: 0, Skipped: 0

(the whole org.codelibs.fess.sso package)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant