Skip to content

Conversation

@lhanusov
Copy link
Contributor

@lhanusov lhanusov commented Jun 6, 2025

Part of: #34494

@lhanusov lhanusov requested a review from a team as a code owner June 6, 2025 14:59
@lhanusov lhanusov marked this pull request as draft June 6, 2025 14:59
@lhanusov
Copy link
Contributor Author

lhanusov commented Jun 6, 2025

waiting for the UserTest PR being merged, there are Page dependencies: #39805

@lhanusov lhanusov force-pushed the 34494/consents branch 4 times, most recently from f9c9b5f to f627489 Compare July 18, 2025 11:44
Comment on lines 412 to 419
private boolean isRefreshToken(String refreshToken) {
String[] items = refreshToken.split(":");
if (items.length != 2) return false;
// Grant type shortcut starts at character 4th char and is 2-chars long
if (!items[0].substring(3, 5).equals(RefreshTokenGrantTypeFactory.GRANT_SHORTCUT)) return false;

return isRefreshToken(items[1]);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This method appears to be unused

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, removed

Comment on lines 83 to 111
@InjectRealm(ref = "user")
ManagedRealm managedRealm;

protected String consumerRealmName() {
return REALM_CONS_NAME;
}
@InjectRealm(ref = "consumer", config = ConsentsRealmCConf.class, lifecycle = LifeCycle.METHOD)
ManagedRealm consumerRealm;

protected String getIDPAlias() {
return IDP_OIDC_ALIAS;
}
@InjectRealm(ref = "provider", lifecycle = LifeCycle.METHOD)
ManagedRealm providerRealm;

@Rule
public AssertEvents events = new AssertEvents(this);
@InjectUser(ref = "user", realmRef = "user", config = ConsentsUserConf.class)
ManagedUser user;

@Page
protected LoginPage accountLoginPage;
@InjectUser(ref = "provider", realmRef = "provider", config = ConsentsUserPConf.class)
ManagedUser userP;

@Page
protected ConsentPage consentPage;
@InjectClient(realmRef = "provider", config = ConsentsClientPConf.class)
ManagedClient client;

@Page
protected AppPage appPage;
@InjectOAuthClient(ref = "user", realmRef = "user")
OAuthClient oauth;

@Page
protected ErrorPage errorPage;
@InjectOAuthClient(ref = "consumer", realmRef = "consumer")
OAuthClient oauthC;

@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {
RealmRepresentation providerRealm = createProviderRealm();
RealmRepresentation consumerRealm = createConsumerRealm();
RealmRepresentation realmRepresentation = loadJson(getClass().getResourceAsStream("/testrealm.json"), RealmRepresentation.class);
@InjectOAuthClient(ref = "provider", realmRef = "provider")
OAuthClient oauthP;

testRealms.add(providerRealm);
testRealms.add(consumerRealm);
testRealms.add(realmRepresentation);
}
@InjectEvents(realmRef = "user")
Events events;
Copy link
Contributor

Choose a reason for hiding this comment

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

The naming in this area is confusing. There's a managedRealm with a ref="user", in that realm, there's a user. There's also a userP which is in providerRealm.

I would unify the names and be a bit more descriptive than oauthC

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, updated

@stianst stianst merged commit d7273e6 into keycloak:main Jul 22, 2025
77 checks passed
robson90 pushed a commit to robson90/keycloak that referenced this pull request Jul 23, 2025
* Moving files to the new test suite

Signed-off-by: Lukas Hanusovsky <[email protected]>

* Move ConsentsTest.java, UserRoleTest.java to the new testsuite

Part of: keycloak#34494

Signed-off-by: Lukas Hanusovsky <[email protected]>

---------

Signed-off-by: Lukas Hanusovsky <[email protected]>
Signed-off-by: Robin Meese <[email protected]>
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