Skip to content
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

DM-41424: Refactor to reduce complexity #889

Merged
merged 9 commits into from
Oct 28, 2023
Merged

DM-41424: Refactor to reduce complexity #889

merged 9 commits into from
Oct 28, 2023

Conversation

rra
Copy link
Member

@rra rra commented Oct 28, 2023

Address all of the Ruff-diagnosed excess complexity by breaking up methods and functions, except for the transformation of Settings to Config. That hasn't yet been addressed.

Move construction of the auth URL for an Ingress created from a
GafaelfawrIngress to the model, since it's a mechanical transformation
of the ingress configuration. This eliminates a warning for an
excessively complex method.
Separate the code to obtain groups from LDAP and possibly add GIDs
from Firestore into a separate internal method to reduce the
complexity of get_user_info_from_token in UserInfoService.
Move the construction of the attribute list to query into another
method to simplify the get_data method of LDAPStorage.
The documentation for the generic auth functions still included some
old handle terminology. We now only use tokens, although they come in
two forms (internal tokens and JWTs).
Move the code to find the token into a private method to simplify
the authenticate method.
Move the code for constructing a delegated token into a separate
function to simplify build_success_headers in the /auth handler.
Bump the McCabe complexity threshold slightly, since handling a
return from an authentication provider should not be simplified
more than it already is. Add some more exclusions from the Nublado
controller source.
Get handle_provider_return down to its minimal reasonable complexity
by breaking te token construction into a separate method and unifying
some of the error handling with a new exception.
Move portions of token auditing into private methods to reduce the
complexity of the method. More of this could be done, but this gets
the audit method below the complexity threshold, so good enough for
now.
@rra rra enabled auto-merge October 28, 2023 00:25
@rra rra merged commit e9a786c into main Oct 28, 2023
5 checks passed
@rra rra deleted the tickets/DM-41424 branch October 28, 2023 00:35
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.

None yet

1 participant