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

Do not remove previous refresh token for federated identity #29109

Merged
merged 2 commits into from Apr 30, 2024

Conversation

sguilhen
Copy link
Contributor

Closes #25815

@sguilhen sguilhen requested a review from a team as a code owner April 26, 2024 13:28
// like in OIDCIdentityProvider.exchangeStoredToken()
// we shouldn't override the refresh token if it is null in the context and not null in the DB
// as for google IDP it will be lost forever
if (federatedIdentityModel.getToken() != null && !(context.getIdp() instanceof SAMLIdentityProvider)) {
Copy link
Contributor

@pedroigor pedroigor Apr 26, 2024

Choose a reason for hiding this comment

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

I think it is better/safer if we check if the idp is a ExchangeTokenToIdentityProviderToken. It will catch both OIDC and OAuth based brokers while at the same time excluding SAML as we don't support internal to external token exchanges for SAML.

This was referenced Apr 26, 2024
@sguilhen sguilhen force-pushed the 25815-fed-identity-refresh-token branch 2 times, most recently from b80d1f1 to 76f6d22 Compare April 26, 2024 16:29
@sguilhen sguilhen changed the title 25815 Do not remove previous refresh token for federated identity Do not remove previous refresh token for federated identity Apr 29, 2024
Signed-off-by: Geoffrey Fourmis <geoffrey.fourmis@gmail.com>
@sguilhen sguilhen force-pushed the 25815-fed-identity-refresh-token branch 2 times, most recently from 407be02 to e3229dc Compare April 30, 2024 11:58
… not an AccessTokenResponse.

- also adds a test for the refresh token on first login scenario.

Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
Copy link

@keycloak-github-bot keycloak-github-bot bot left a comment

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@keycloak-github-bot
Copy link

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.x509.X509BrowserCRLTest#loginFailedWithIntermediateRevocationListFromHttp

Keycloak CI - FIPS IT (strict)

java.lang.RuntimeException: Could not create statement
	at org.jboss.arquillian.junit.Arquillian.methodBlock(Arquillian.java:307)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
...

Report flaky test

@pedroigor pedroigor merged commit 02e2ebf into keycloak:main Apr 30, 2024
70 checks passed
@sguilhen sguilhen deleted the 25815-fed-identity-refresh-token branch May 7, 2024 20:08
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.

Loosing refresh token with Google Identity Provider
3 participants