8000 Remove deprecated method OAuthClient#clientId by stianst · Pull Request #48240 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ public String getClientSecret() {
return clientSecret;
}

public OAuthClientConfig clientId(String clientId) {
this.clientId = clientId;
return this;
}

public OAuthClientConfig client(String clientId) {
this.clientId = clientId;
this.clientSecret = null;
Expand Down
10BC8
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,6 @@ public void fillLoginForm(String username, String password) {
loginPage.login(username, password);
}

/**
* @deprecated This method is deprecated, use {@link OAuthClient#client(String)} for public clients,
* or {@link OAuthClient#client(String, String)} for confidential clients
*/
@Deprecated
public OAuthClient clientId(String clientId) {
config.clientId(clientId);
return this;
}

public WebDriver getDriver() {
return driver;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1475,7 +1475,7 @@ public void listApplicationsThirdParty(String clientScopeName, boolean expectCon

@Test
public void listApplicationsWithRootUrl() throws Exception {
oauth.clientId("root-url-client");
oauth.client("root-url-client", "password");
AccessTokenResponse tokenResponse = oauth.doPasswordGrantRequest("view-applications-access", "password");
assertNull(tokenResponse.getErrorDescription());

Expand Down Expand Up @@ -1973,7 +1973,7 @@ public void testInvalidApiVersion() throws IOException {

@Test
public void testAudience() throws Exception {
oauth.clientId("custom-audience");
oauth.client("custom-audience", "password");
AccessTokenResponse tokenResponse = oauth.doPasswordGrantRequest("test-user@localhost", "password");
assertNull(tokenResponse.getErrorDescription());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ private AccessTokenResponse codeGrant(String clientId) {
}

private void joinSsoSession(String clientId) {
oauth.clientId(clientId);
oauth.client(clientId);
oauth.redirectUri(OAuthClient.APP_ROOT + "/auth");
oauth.openLoginForm();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ public void testAttributeRequiredForScope() {
+ "{\"name\": \"department\"," + PERMISSIONS_ALL + ", \"required\":{\"scopes\":[\"" + SCOPE_DEPARTMENT + "\"]}}"
+ "]}");

oauth.scope(SCOPE_DEPARTMENT).clientId(client_scope_optional.getClientId()).openLoginForm();
oauth.scope(SCOPE_DEPARTMENT).client(client_scope_optional.getClientId()).openLoginForm();

loginPage.assertCurrent();
loginPage.login(USERNAME1, PASSWORD);
Expand Down Expand Up @@ -496,7 +496,7 @@ public void testAttributeRequiredForDefaultScope() {
+ "{\"name\": \"department\"," + PERMISSIONS_ALL + ", \"required\":{\"scopes\":[\"" + SCOPE_DEPARTMENT + "\"]}}"
+ "]}");

oauth.clientId(client_scope_default.getClientId()).openLoginForm();
oauth.client(client_scope_default.getClientId()).openLoginForm();

loginPage.assertCurrent();
loginPage.login(USERNAME1, PASSWORD);
Expand Down Expand Up @@ -530,7 +530,7 @@ public void testAttributeRequiredAndSelectedByScope() {
+ "{\"name\": \"department\"," + PERMISSIONS_ALL + ", \"required\":{}, \"selector\":{\"scopes\":[\"" + SCOPE_DEPARTMENT + "\"]}}"
+ "]}");

oauth.scope(SCOPE_DEPARTMENT).clientId(client_scope_optional.getClientId()).openLoginForm();
oauth.scope(SCOPE_DEPARTMENT).client(client_scope_optional.getClientId()).openLoginForm();

loginPage.assertCurrent();
loginPage.login(USERNAME1, PASSWORD);
Expand Down Expand Up @@ -564,7 +564,7 @@ public void testAttributeNotRequiredAndSelectedByScopeCanBeUpdated() {
+ "{\"name\": \"department\"," + PERMISSIONS_ALL + ", \"selector\":{\"scopes\":[\"" + SCOPE_DEPARTMENT + "\"]}}"
+ "]}");

oauth.scope(SCOPE_DEPARTMENT).clientId(client_scope_optional.getClientId()).openLoginForm();
oauth.scope(SCOPE_DEPARTMENT).client(client_scope_optional.getClientId()).openLoginForm();

loginPage.assertCurrent();
loginPage.login(USERNAME1, PASSWORD);
Expand Down Expand Up @@ -593,7 +593,7 @@ public void testAttributeRequiredButNotSelectedByScopeIsNotRendered() {
+ "{\"name\": \"department\"," + PERMISSIONS_ALL + ", \"required\":{}, \"selector\":{\"scopes\":[\"" + SCOPE_DEPARTMENT + "\"]}}"
+ "]}");

oauth.clientId(client_scope_optional.getClientId()).openLoginForm();
oauth.client(client_scope_optional.getClientId()).openLoginForm();

loginPage.assertCurrent();
loginPage.login(USERNAME1, PASSWORD);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public void testInvalidRequestWithClaimsFromConfidentialClient() throws IOExcept
@Test
public void testInvalidRequestWithClaimsFromPublicClient() throws IOException {
oauth.realm("authz-test");
oauth.clientId(PUBLIC_TEST_CLIENT);
oauth.client(PUBLIC_TEST_CLIENT);

oauth.doLogin("marta", "password");

Expand All @@ -268,7 +268,7 @@ public void testInvalidRequestWithClaimsFromPublicClient() throws IOException {
@Test
public void testRequestWithoutClaimsFromPublicClient() {
oauth.realm("authz-test");
oauth.clientId(PUBLIC_TEST_CLIENT);
oauth.client(PUBLIC_TEST_CLIENT);

oauth.doLogin("marta", "password");

Expand Down Expand Up @@ -2006,7 +2006,7 @@ public void testProcessMappersForTargetAudience() throws Exception {
authorization.permissions().resource().create(permission).close();

oauth.realm("authz-test");
oauth.clientId(PUBLIC_TEST_CLIENT);
oauth.client(PUBLIC_TEST_CLIENT);
oauth.doLogin("marta", "password");

// Token request
Expand Down Expand Up @@ -2074,7 +2074,7 @@ public void testIntrospectRPTCreatedFromOfflineTokenDifferentClient() throws Exc

oauth.realm("authz-test");
oauth.scope(OAuth2Constants.OFFLINE_ACCESS);
oauth.clientId(PUBLIC_TEST_CLIENT);
oauth.client(PUBLIC_TEST_CLIENT);
oauth.doLogin("offlineuser", "password");

// Token request
Expand Down Expand Up @@ -2121,7 +2121,7 @@ public void testRefreshTokenFromClientOtherThanAudience() throws Exception {
@Test
public void testTokenExpirationRenewalWhenIssuingTokens() {
oauth.realm("authz-test");
oauth.clientId(PUBLIC_TEST_CLIENT);
oauth.client(PUBLIC_TEST_CLIENT);
oauth.doLogin("marta", "password");
String code = oauth.parseLoginResponse().getCode();
org.keycloak.testsuite.util.oauth.AccessTokenResponse accessTokenResponse = oauth.doAccessTokenRequest(code);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public void loginWithExistingUserWithBruteForceEnabled() {
logoutFromConsumerRealm();
AccountHelper.logout(adminClient.realm(bc.providerRealmName()), bc.getUserLogin());

oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

try {
Expand Down Expand Up @@ -233,7 +233,7 @@ public void loginWithExistingUserWithErrorFromProviderIdP() {
.get(client.getId())
.update(ClientBuilder.edit(client).consentRequired(true).build());

oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

logInWithBroker(bc);
Expand Down Expand Up @@ -273,7 +273,7 @@ public void testDisabledUser() {

user.update(userRep);

oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

logInWithBroker(bc);
Expand Down Expand Up @@ -387,7 +387,7 @@ public void differentMappersCanHaveDifferentSyncModes() {

userResource.roles().realmLevel().add(Arrays.asList(userRole, friendlyManagerRole));

oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

logInAsUserInIDP();
Expand All @@ -405,7 +405,7 @@ public void differentMappersCanHaveDifferentSyncModes() {
// KEYCLOAK-4016
@Test
public void testExpiredCode() {
oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

log.debug("Expire all browser cookies");
Expand All @@ -430,7 +430,7 @@ public void testPostBrokerLoginFlowWithOTP() {
updateExecutions(AbstractBrokerTest::disableUpdateProfileOnFirstLogin);
testingClient.server(bc.consumerRealmName()).run(configurePostBrokerLoginWithOTP(bc.getIDPAlias()));

oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

logInWithBroker(bc);
Expand All @@ -446,7 +446,7 @@ public void testPostBrokerLoginFlowWithOTP() {

setOtpTimeOffset(TimeBasedOTP.DEFAULT_INTERVAL_SECONDS, totp);

oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

logInWithBroker(bc);
Expand All @@ -459,7 +459,7 @@ public void testPostBrokerLoginFlowWithOTP() {

testingClient.server(bc.consumerRealmName()).run(disablePostBrokerLoginFlow(bc.getIDPAlias()));

oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

logInWithBroker(bc);
Expand All @@ -481,7 +481,7 @@ public void testLogoutWorksWithTokenTimeout() {
adminClient.realm(bc.consumerRealmName()).identityProviders().get(bc.getIDPAlias()).update(idp);
Time.setOffset(10);

oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

logInWithBroker(bc);
Expand All @@ -491,7 +491,7 @@ public void testLogoutWorksWithTokenTimeout() {

logoutFromConsumerRealm();

oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

waitForPage(driver, "sign in to", true);
Expand Down Expand Up @@ -519,7 +519,7 @@ public void testWithLinkedFederationProvider() {

createUser(bc.providerRealmName(), "test-user", "password", "FirstName", "LastName", "test-user@localhost.com");

oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

loginPage.clickSocial(bc.getIDPAlias());
Expand All @@ -537,7 +537,7 @@ public void testWithLinkedFederationProvider() {

createUser(bc.providerRealmName(), "test-user-noemail", "password", "FirstName", "LastName", "test-user-noemail@localhost.com");

oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

loginPage.clickSocial(bc.getIDPAlias());
Expand All @@ -557,7 +557,7 @@ public void testDisabledBroker() {
logoutFromConsumerRealm();
AccountHelper.logout(adminClient.realm(bc.providerRealmName()), bc.getUserLogin());

oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

RealmResource realm = adminClient.realm(bc.consumerRealmName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ protected void logInAsUserInIDP() {
}

protected void logInAsUserInIDP(String clientId) {
oauth.clientId(clientId);
oauth.client(clientId);
loginPage.open(bc.consumerRealmName());
logInWithBroker(bc);
}

// We are re-authenticating to the IDP. Hence it is assumed that "username" field is not visible on the login form on the IDP side
protected void logInAsUserInIDPWithReAuthenticate() {
oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

waitForPage(driver, "sign in to", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public void loginWithExistingUser() {

Integer userCount = adminClient.realm(bc.consumerRealmName()).users().count();

oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

if (isUsingTransientSessions()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void testDefaultIdpNotSet() {
configureFlow(null);

// Navigate to the auth page
oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.consumerRealmName());

waitForPage(driver, "sign in to", true);
Expand All @@ -85,7 +85,7 @@ public void testDefaultIdpSet() {
createUser(bc.providerRealmName(), username, "password", "FirstName");

// Navigate to the auth page
oauth.clientId("broker-app");
oauth.client("broker-app");
loginPage.open(bc.providerRealmName());

waitForPage(driver, "sign in to", true);
Expand All @@ -103,7 +103,7 @@ protected void testDefaultIdpSetTriedAndReturnedError(String expectedErrorMessag
createUser(bc.providerRealmName(), username, "password", "FirstName");

// Navigate to the auth page
oauth.clientId("broker-app");
oauth.client("broker-app");
oauth.realm(bc.consumerRealmName());
oauth.openLoginForm();

Expand Down
Loading
Loading
0