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

Refactoring UAA client #3474

Merged

Conversation

philippthun
Copy link
Member

@philippthun philippthun commented Oct 11, 2023

While working on the "Support UAA identity zones in CC" PoC [1], I did some refactoring that I would like to keep although the PoC is not going to get implemented (see [2]).

[1] #3341
[2] cloudfoundry/uaa#2505

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

While working on the "Support UAA identity zones in CC" PoC [1], I did
some refactoring that I would like to keep although the PoC is not going
to get implemented (see [2]).

[1] cloudfoundry#3341
[2] cloudfoundry/uaa#2505
@philippthun philippthun marked this pull request as ready for review October 12, 2023 08:15
@kathap
Copy link
Contributor

kathap commented Oct 13, 2023

I can see use of uaa_client in

let(:username_populator) { UsernamePopulator.new(uaa_client) }

and
let(:username_populator) { UsernamesAndRolesPopulator.new(uaa_client) }

maybe there it should also be uaa_username_lookup_client

@philippthun
Copy link
Member Author

I can see use of uaa_client in

let(:username_populator) { UsernamePopulator.new(uaa_client) }

and

let(:username_populator) { UsernamesAndRolesPopulator.new(uaa_client) }

maybe there it should also be uaa_username_lookup_client

I've changed the name to uaa_username_lookup_client in the DependencyLocator to incorporate the use case this UAA client is used for (and the permissions it has). And then I've adapted all places where the client is fetched from the DependencyLocator. I did not change other places where it is just a variable holding an instance of class UaaClient. In the end this particular uaa_username_lookup_client would also be used inside UsernamePopulator and UsernamesAndRolesPopulator, but there the longer name would make reading the code more complicated without adding much benefit (i.e. there are not multiple UAA clients involved). I've looked again through the code and would rather keep uaa_client in all the tests where it is just a mock object.

Copy link
Member

@moleske moleske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me. had same question that @kathap but your answer makes sense to me

@philippthun philippthun merged commit cdb540c into cloudfoundry:main Nov 20, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants