Skip to content
Snippets Groups Projects

Initialize gitLab object when in logging in with token

Merged username-removed-1593756 requested to merge bschuhm/LabCoat:master into master

Fix for #316 (closed)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Can you explain how this fixes it? It seems like it is just moving around where you create the client builder. It's hard to follow, am I missing something?

  • Of course.

    In the case of a token login, we would go through : login() -> connect(false) -> connectByToken() -> loadUser().
    And nowhere on this path the gitLab object is initialized.
    This is a problem around line 403 where we can't get a hostNameVerifier.

    At first I initialized the gitLab object in loadUser(), which worked.
    But then for auth login it would create the object twice because attemptLogin() creates it and calls loadUser() later.

    I did not know if it would be a problem, and it was not very clean anyway so I tried moving the init in connectByToken() without changing anything in loadUser().
    It did not work. Then I found the comment on line 328 :

            // This seems useless - But believe me, it makes everything work! Don't remove it.
            // (OkHttpClientFactory caches the clients and needs a new account to recreate them)

    So my guess is the caching in OkHttpClientFactory was messing things up when I called create twice.
    So I decided to reuse the gitlabClientBuilder by passing it through to loadUser().

    I renamed the local gitLab to gitLabService because it was masking the class object and I thought it was confusing.

    Auth login is OK as far as I tested.

    Edited by username-removed-1593756
  • Awesome @bschuhm thanks for the clarification. This login process could use some cleaning up, thanks for finding and resolving this issue, I am sure it will fix issues for a lot of others as well. :thumbsup:

  • mentioned in commit c0e79242

Please register or sign in to reply
Loading