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

update updated OpenId access and refresh token in memory config #5888

Merged
merged 5 commits into from
Apr 16, 2024

Conversation

ttbadr
Copy link
Contributor

@ttbadr ttbadr commented Apr 13, 2024

Description

Fix #5880

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

@rohanKanojia
Copy link
Member

@ttbadr : Could you please run mvn spotless:apply to fix style failures?

@ttbadr
Copy link
Contributor Author

ttbadr commented Apr 13, 2024

@ttbadr : Could you please run mvn spotless:apply to fix style failures?

@rohanKanojia fixed

@manusa manusa added this to the 6.13.0 milestone Apr 13, 2024 — with automated-tasks
Copy link

sonarcloud bot commented Apr 16, 2024

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.*;
Copy link
Member

Choose a reason for hiding this comment

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

Could you please revert this import related change?

@manusa manusa modified the milestones: 6.13.0, 6.12.1 Apr 16, 2024
Copy link
Member

@manusa manusa left a comment

Choose a reason for hiding this comment

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

LGTM, thx!

@manusa manusa merged commit 4ec7c99 into fabric8io:main Apr 16, 2024
20 checks passed
@@ -242,6 +240,12 @@ static boolean persistKubeConfigWithUpdatedToken(Config currentConfig, Map<Strin
*/
public static boolean persistKubeConfigWithUpdatedAuthInfo(Config currentConfig, Consumer<AuthInfo> updateAction)
throws IOException {
AuthInfo authInfo = new AuthInfo();
authInfo.setAuthProvider(new AuthProviderConfig(new HashMap<>(2), currentConfig.getAuthProvider().getName()));
Copy link
Member

Choose a reason for hiding this comment

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

This leads to a NPE if the current config has no auth provider set

Copy link
Member

Choose a reason for hiding this comment

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

Currently working on some refactors and fixes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This leads to a NPE if the current config has no auth provider set

I think the OpenIDConnectionUtils wouldn't be invoked if no auth provider set, right?

Copy link
Member

Choose a reason for hiding this comment

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

Probably not, but that's unclear in tests.
Also the method is reused elsewhere (i.e. this one is called from the OpenShiftOAuthInterceptor) because it was public.

Anyway, this might have some ramifications. I'll work on refactoring some of this stuff and maybe moving it elsewhere to avoid latent bugs.

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.

OpenId token not refreshed if the config is in-memory
3 participants