Skip to content

Commit 0832992

Browse files
stianstmposolda
andcommitted
Removing OpenShift integration and moving to separate extension
closes keycloak#20496 Co-authored-by: mposolda <[email protected]>
1 parent 9ad295a commit 0832992

File tree

51 files changed

+293
-3590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+293
-3590
lines changed

common/src/main/java/org/keycloak/common/Profile.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ public enum Feature {
5757

5858
IMPERSONATION("Ability for admins to impersonate users", Type.DEFAULT),
5959

60-
OPENSHIFT_INTEGRATION("Extension to enable securing OpenShift", Type.PREVIEW),
61-
6260
SCRIPTS("Write custom authenticators using JavaScript", Type.PREVIEW),
6361

6462
TOKEN_EXCHANGE("Token Exchange Service", Type.PREVIEW),

common/src/test/java/org/keycloak/common/ProfileTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ public void checkDefaults() {
7979
Profile.Feature.RECOVERY_CODES,
8080
Profile.Feature.SCRIPTS,
8181
Profile.Feature.TOKEN_EXCHANGE,
82-
Profile.Feature.OPENSHIFT_INTEGRATION,
8382
Profile.Feature.MAP_STORAGE,
8483
Profile.Feature.DECLARATIVE_USER_PROFILE,
8584
Profile.Feature.CLIENT_SECRET_ROTATION,
@@ -91,7 +90,7 @@ public void checkDefaults() {
9190
disabledFeatures.add(Profile.Feature.KERBEROS);
9291
}
9392
assertEquals(profile.getDisabledFeatures(), disabledFeatures);
94-
assertEquals(profile.getPreviewFeatures(), Profile.Feature.ADMIN_FINE_GRAINED_AUTHZ, Profile.Feature.RECOVERY_CODES, Profile.Feature.SCRIPTS, Profile.Feature.TOKEN_EXCHANGE, Profile.Feature.OPENSHIFT_INTEGRATION, Profile.Feature.DECLARATIVE_USER_PROFILE, Profile.Feature.CLIENT_SECRET_ROTATION, Profile.Feature.UPDATE_EMAIL);
93+
assertEquals(profile.getPreviewFeatures(), Profile.Feature.ADMIN_FINE_GRAINED_AUTHZ, Profile.Feature.RECOVERY_CODES, Profile.Feature.SCRIPTS, Profile.Feature.TOKEN_EXCHANGE, Profile.Feature.DECLARATIVE_USER_PROFILE, Profile.Feature.CLIENT_SECRET_ROTATION, Profile.Feature.UPDATE_EMAIL);
9594
}
9695

9796
@Test

dependencies/server-all/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,6 @@
112112
<groupId>org.keycloak</groupId>
113113
<artifactId>keycloak-authz-policy-common</artifactId>
114114
</dependency>
115-
116-
<dependency>
117-
<groupId>com.openshift</groupId>
118-
<artifactId>openshift-restclient-java</artifactId>
119-
</dependency>
120115
</dependencies>
121116

122117
</project>

docs/documentation/release_notes/topics/22_0_0.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,9 @@ For example, let's assume we want to overwrite the https://github.com/keycloak/k
5555
Installations which use Keycloak's `--proxy` configuration setting with mode *passthrough* should review the documentation as the behavior of this mode has changed.
5656

5757
See the migration guide for more details.
58+
59+
= Removed openshift-integration feature and related providers
60+
61+
The `openshift-integration` preview feature was removed from Keycloak codebase into separate extension project.
62+
63+
See the migration guide for more details.

docs/documentation/upgrading/topics/keycloak/changes-22_0_0.adoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,20 @@ This change is already in our documentation and in our quickstart repository. Fo
226226
If you cannot migrate your applications to Jakarta, you can still use the "legacy" SAML JEE adapter and still
227227
be able to integrate with future releases of the server. However, consider upgrading your applications as soon as possible
228228
because we are no longer providing support to JEE.
229+
230+
= Changes for openshift-integration feature
231+
232+
The preview feature `openshift-integration` was removed from Keycloak codebase and moved into separate extension. This includes
233+
moving of related providers such as custom client storage provider and token review endpoint for Openshift integration.
234+
235+
If you used this feature, you should not use the `openshift-integration` feature anymore when starting Keycloak server and instead you need to deploy
236+
the JAR file from custom extension. You can check the https://github.com/keycloak-extensions/keycloak-openshift-ext/[Openshift extension] and the instructions
237+
in it's README file for how to deploy the extension to your Keycloak server.
238+
239+
= Removing thirdparty dependencies
240+
241+
The removal of openshift-integration allows us to remove few thirdparty dependencies from Keycloak distribution. This includes
242+
`openshift-rest-client`, `okio-jvm`, `okhttp`, `commons-lang`, `commons-compress`, `jboss-dmr` and `kotlin-stdlib`. This means that if you use
243+
any of these libraries as dependencies of your own providers deployed to Keycloak server, you may also need to copy those `jar` files
244+
explicitly to the Keycloak distribution `providers` directory as well.
245+

federation/sssd/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
<artifactId>jboss-logging</artifactId>
8585
<scope>provided</scope>
8686
</dependency>
87+
<dependency>
88+
<groupId>org.slf4j</groupId>
89+
<artifactId>slf4j-api</artifactId>
90+
<scope>provided</scope>
91+
</dependency>
8792
</dependencies>
8893

8994
<profiles>
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
/*
2+
* Copyright 2023 Red Hat, Inc. and/or its affiliates
3+
* and other contributors as indicated by the @author tags.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
*
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
*/
19+
20+
package org.keycloak.test.builders;
21+
22+
import java.util.ArrayList;
23+
import java.util.Arrays;
24+
import java.util.HashMap;
25+
import java.util.LinkedList;
26+
27+
import org.keycloak.models.credential.OTPCredentialModel;
28+
import org.keycloak.models.utils.HmacOTP;
29+
import org.keycloak.models.utils.ModelToRepresentation;
30+
import org.keycloak.representations.idm.CredentialRepresentation;
31+
import org.keycloak.representations.idm.FederatedIdentityRepresentation;
32+
import org.keycloak.representations.idm.UserRepresentation;
33+
34+
/**
35+
* @author <a href="mailto:[email protected]">Stian Thorgersen</a>
36+
*/
37+
public class UserBuilder {
38+
39+
private final UserRepresentation rep;
40+
41+
public static UserBuilder create() {
42+
UserRepresentation rep = new UserRepresentation();
43+
rep.setEnabled(Boolean.TRUE);
44+
return new UserBuilder(rep);
45+
}
46+
47+
public static UserBuilder edit(UserRepresentation rep) {
48+
return new UserBuilder(rep);
49+
}
50+
51+
private UserBuilder(UserRepresentation rep) {
52+
this.rep = rep;
53+
}
54+
55+
public UserBuilder id(String id) {
56+
rep.setId(id);
57+
return this;
58+
}
59+
60+
public UserBuilder username(String username) {
61+
rep.setUsername(username);
62+
return this;
63+
}
64+
65+
public UserBuilder firstName(String firstName) {
66+
rep.setFirstName(firstName);
67+
return this;
68+
}
69+
70+
public UserBuilder lastName(String lastName) {
71+
rep.setLastName(lastName);
72+
return this;
73+
}
74+
75+
/**
76+
* This method adds additional passwords to the user.
77+
*/
78+
public UserBuilder addPassword(String password) {
79+
if (rep.getCredentials() == null) {
80+
rep.setCredentials(new LinkedList<>());
81+
}
82+
83+
CredentialRepresentation credential = new CredentialRepresentation();
84+
credential.setType(CredentialRepresentation.PASSWORD);
85+
credential.setValue(password);
86+
87+
rep.getCredentials().add(credential);
88+
return this;
89+
}
90+
91+
public UserBuilder addAttribute(String name, String... values) {
92+
if (rep.getAttributes() == null) {
93+
rep.setAttributes(new HashMap<>());
94+
}
95+
96+
rep.getAttributes().put(name, Arrays.asList(values));
97+
return this;
98+
}
99+
100+
/**
101+
* This method makes sure that there is one single password for the user.
102+
*/
103+
public UserBuilder password(String password) {
104+
rep.setCredentials(null);
105+
return addPassword(password);
106+
}
107+
108+
public UserBuilder email(String email) {
109+
rep.setEmail(email);
110+
return this;
111+
}
112+
113+
public UserBuilder emailVerified(boolean emailVerified) {
114+
rep.setEmailVerified(emailVerified);
115+
return this;
116+
}
117+
118+
public UserBuilder enabled(boolean enabled) {
119+
rep.setEnabled(enabled);
120+
return this;
121+
}
122+
123+
public UserBuilder addRoles(String... roles) {
124+
if (rep.getRealmRoles() == null) {
125+
rep.setRealmRoles(new ArrayList<>());
126+
}
127+
rep.getRealmRoles().addAll(Arrays.asList(roles));
128+
return this;
129+
}
130+
131+
public UserBuilder role(String client, String role) {
132+
if (rep.getClientRoles() == null) {
133+
rep.setClientRoles(new HashMap<>());
134+
}
135+
if (rep.getClientRoles().get(client) == null) {
136+
rep.getClientRoles().put(client, new LinkedList<>());
137+
}
138+
rep.getClientRoles().get(client).add(role);
139+
return this;
140+
}
141+
142+
public UserBuilder requiredAction(String requiredAction) {
143+
if (rep.getRequiredActions() == null) {
144+
rep.setRequiredActions(new LinkedList<>());
145+
}
146+
rep.getRequiredActions().add(requiredAction);
147+
return this;
148+
}
149+
150+
public UserBuilder serviceAccountId(String serviceAccountId) {
151+
rep.setServiceAccountClientId(serviceAccountId);
152+
return this;
153+
}
154+
155+
public UserBuilder secret(CredentialRepresentation credential) {
156+
if (rep.getCredentials() == null) {
157+
rep.setCredentials(new LinkedList<>());
158+
}
159+
160+
rep.getCredentials().add(credential);
161+
rep.setTotp(true);
162+
return this;
163+
}
164+
165+
public UserBuilder totpSecret(String totpSecret) {
166+
CredentialRepresentation credential = ModelToRepresentation.toRepresentation(
167+
OTPCredentialModel.createTOTP(totpSecret, 6, 30, HmacOTP.HMAC_SHA1));
168+
return secret(credential);
169+
}
170+
171+
public UserBuilder hotpSecret(String hotpSecret) {
172+
CredentialRepresentation credential = ModelToRepresentation.toRepresentation(
173+
OTPCredentialModel.createHOTP(hotpSecret, 6, 0, HmacOTP.HMAC_SHA1));
174+
return secret(credential);
175+
}
176+
177+
public UserBuilder otpEnabled() {
178+
rep.setTotp(Boolean.TRUE);
179+
return this;
180+
}
181+
182+
public UserBuilder addGroups(String... group) {
183+
if (rep.getGroups() == null) {
184+
rep.setGroups(new ArrayList<>());
185+
}
186+
rep.getGroups().addAll(Arrays.asList(group));
187+
return this;
188+
}
189+
190+
public UserBuilder federatedLink(String identityProvider, String federatedUserId) {
191+
if (rep.getFederatedIdentities() == null) {
192+
rep.setFederatedIdentities(new LinkedList<>());
193+
}
194+
FederatedIdentityRepresentation federatedIdentity = new FederatedIdentityRepresentation();
195+
federatedIdentity.setUserId(federatedUserId);
196+
federatedIdentity.setUserName(rep.getUsername());
197+
federatedIdentity.setIdentityProvider(identityProvider);
198+
199+
rep.getFederatedIdentities().add(federatedIdentity);
200+
return this;
201+
}
202+
203+
public UserRepresentation build() {
204+
return rep;
205+
}
206+
}

model/legacy-services/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@
4343
<artifactId>hamcrest</artifactId>
4444
<scope>test</scope>
4545
</dependency>
46-
<dependency>
47-
<groupId>com.openshift</groupId>
48-
<artifactId>openshift-restclient-java</artifactId>
49-
</dependency>
5046
<dependency>
5147
<groupId>org.jboss.resteasy</groupId>
5248
<artifactId>resteasy-core</artifactId>

0 commit comments

Comments
 (0)