Skip to content

Commit

Permalink
KEYCLOAK-18512: Integrate New Admin Console into Keycloak build (keyc…
Browse files Browse the repository at this point in the history
…loak#8366)

* KEYCLOAK-18512: Integrate New Admin Console into Keycloak build

* KEYCLOAK-18512: Integrate New Admin Console into Keycloak build

* Change version to project version.  Make experimental.

* Add PAT for reading packages (keycloak#12)

* Add PAT for reading packages

* Encode token

* Use generic GH account for installation of packages

* Enable Github packages repo only for snapshots

* KEYCLOAK-18512: Make ADMIN2 experimental instead of preview

* KEYCLOAK-18512: Remove early return

* KEYCLOAK-18512: Fix formatting issue

Co-authored-by: Jon Koops <jonkoops@gmail.com>
  • Loading branch information
ssilvert and jonkoops authored Sep 15, 2021
1 parent 24811f1 commit 93e229e
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 17 deletions.
1 change: 1 addition & 0 deletions common/src/main/java/org/keycloak/common/Profile.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public enum Feature {
ACCOUNT2(Type.DEFAULT),
ACCOUNT_API(Type.DEFAULT),
ADMIN_FINE_GRAINED_AUTHZ(Type.PREVIEW),
ADMIN2(Type.EXPERIMENTAL),
DOCKER(Type.DISABLED_BY_DEFAULT),
IMPERSONATION(Type.DEFAULT),
OPENSHIFT_INTEGRATION(Type.PREVIEW),
Expand Down
6 changes: 2 additions & 4 deletions common/src/test/java/org/keycloak/common/ProfileTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public class ProfileTest {
@Test
public void checkDefaultsKeycloak() {
Assert.assertEquals("community", Profile.getName());

assertEquals(Profile.getDisabledFeatures(), Profile.Feature.ADMIN_FINE_GRAINED_AUTHZ, Profile.Feature.DOCKER, Profile.Feature.SCRIPTS, Profile.Feature.TOKEN_EXCHANGE, Profile.Feature.OPENSHIFT_INTEGRATION, Profile.Feature.UPLOAD_SCRIPTS, Profile.Feature.MAP_STORAGE, Profile.Feature.DECLARATIVE_USER_PROFILE);
assertEquals(Profile.getDisabledFeatures(), Profile.Feature.ADMIN_FINE_GRAINED_AUTHZ, Profile.Feature.ADMIN2, Profile.Feature.DOCKER, Profile.Feature.SCRIPTS, Profile.Feature.TOKEN_EXCHANGE, Profile.Feature.OPENSHIFT_INTEGRATION, Profile.Feature.UPLOAD_SCRIPTS, Profile.Feature.MAP_STORAGE, Profile.Feature.DECLARATIVE_USER_PROFILE);
assertEquals(Profile.getPreviewFeatures(), Profile.Feature.ADMIN_FINE_GRAINED_AUTHZ, Profile.Feature.SCRIPTS, Profile.Feature.TOKEN_EXCHANGE, Profile.Feature.OPENSHIFT_INTEGRATION, Profile.Feature.DECLARATIVE_USER_PROFILE);
assertEquals(Profile.getDeprecatedFeatures(), Profile.Feature.UPLOAD_SCRIPTS);

Expand All @@ -38,8 +37,7 @@ public void checkDefaultsRH_SSO() {
Profile.init();

Assert.assertEquals("product", Profile.getName());

assertEquals(Profile.getDisabledFeatures(), Profile.Feature.ADMIN_FINE_GRAINED_AUTHZ, Profile.Feature.DOCKER, Profile.Feature.SCRIPTS, Profile.Feature.TOKEN_EXCHANGE, Profile.Feature.OPENSHIFT_INTEGRATION, Profile.Feature.UPLOAD_SCRIPTS, Profile.Feature.WEB_AUTHN, Profile.Feature.MAP_STORAGE, Profile.Feature.DECLARATIVE_USER_PROFILE);
assertEquals(Profile.getDisabledFeatures(), Profile.Feature.ADMIN_FINE_GRAINED_AUTHZ, Profile.Feature.ADMIN2, Profile.Feature.DOCKER, Profile.Feature.SCRIPTS, Profile.Feature.TOKEN_EXCHANGE, Profile.Feature.OPENSHIFT_INTEGRATION, Profile.Feature.UPLOAD_SCRIPTS, Profile.Feature.WEB_AUTHN, Profile.Feature.MAP_STORAGE, Profile.Feature.DECLARATIVE_USER_PROFILE);
assertEquals(Profile.getPreviewFeatures(), Profile.Feature.ADMIN_FINE_GRAINED_AUTHZ, Profile.Feature.SCRIPTS, Profile.Feature.TOKEN_EXCHANGE, Profile.Feature.OPENSHIFT_INTEGRATION, Profile.Feature.WEB_AUTHN, Profile.Feature.DECLARATIVE_USER_PROFILE);
assertEquals(Profile.getDeprecatedFeatures(), Profile.Feature.UPLOAD_SCRIPTS);

Expand Down
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,11 @@
<artifactId>keycloak-quarkus-server-app</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-admin-ui</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Openshift -->
<dependency>
Expand Down Expand Up @@ -2035,4 +2040,4 @@
</profile>

</profiles>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ public Response getMainPage() throws IOException, FreeMarkerException {
map.put("resourceCommonUrl", Urls.themeRoot(adminBaseUri).getPath() + "/common/keycloak");
map.put("masterRealm", Config.getAdminRealm());
map.put("resourceVersion", Version.RESOURCES_VERSION);
map.put("loginRealm", realm.getName());
map.put("properties", theme.getProperties());

FreeMarkerUtil freeMarkerUtil = new FreeMarkerUtil();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,9 @@ private void setThemes(ServerInfoRepresentation info) {
info.setThemes(new HashMap<>());

for (Theme.Type type : Theme.Type.values()) {
List<String> themeNames = new LinkedList<>(session.theme().nameSet(type));
List<String> themeNames = filterThemes(type, new LinkedList<>(session.theme().nameSet(type)));
Collections.sort(themeNames);

if (!Profile.isFeatureEnabled(Profile.Feature.ACCOUNT2)) {
themeNames.remove("keycloak.v2");
themeNames.remove("rh-sso.v2");
}

List<ThemeInfoRepresentation> themes = new LinkedList<>();
info.getThemes().put(type.toString().toLowerCase(), themes);

Expand All @@ -196,6 +191,22 @@ private void setThemes(ServerInfoRepresentation info) {
}
}
}

private LinkedList<String> filterThemes(Theme.Type type, LinkedList<String> themeNames) {
LinkedList<String> filteredNames = new LinkedList<>(themeNames);

boolean filterAccountV2 = (type == Theme.Type.ACCOUNT) &&
!Profile.isFeatureEnabled(Profile.Feature.ACCOUNT2);
boolean filterAdminV2 = (type == Theme.Type.ADMIN) &&
!Profile.isFeatureEnabled(Profile.Feature.ADMIN2);

if (filterAccountV2 || filterAdminV2) {
filteredNames.remove("keycloak.v2");
filteredNames.remove("rh-sso.v2");
}

return filteredNames;
}

private void setSocialProviders(ServerInfoRepresentation info) {
info.setSocialProviders(new LinkedList<>());
Expand Down
57 changes: 51 additions & 6 deletions themes/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>keycloak-parent</artifactId>
<groupId>org.keycloak</groupId>
Expand All @@ -10,7 +9,7 @@

<artifactId>keycloak-themes</artifactId>
<name>Keycloak Themes</name>
<description/>
<description />
<packaging>jar</packaging>

<properties>
Expand All @@ -19,6 +18,20 @@
<args.npm.install>ci --no-optional --ignore-scripts</args.npm.install>
</properties>

<repositories>
<repository>
<id>github</id>
<url>https://keycloak-packages:&#103;hp_tSeU74eZVGTSupVCap28N8TX0M88YJ06kua9@maven.pkg.github.com/keycloak/keycloak-admin-ui</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -122,10 +135,10 @@
<exclude>**/Gruntfile.js</exclude>
<exclude>**/Gemfile*</exclude>
<exclude>**/.*</exclude>

<!-- Remove once rcue stops shipping this file -->
<exclude>**/git-Logo.svg</exclude>

<exclude>**/keycloak.v2/account/src/**</exclude>
</excludes>
</resource>
Expand All @@ -140,12 +153,44 @@
<name>!product</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-admin-ui</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources-community</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>compile</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-admin-ui</artifactId>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/classes/theme/keycloak.v2</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
Expand Down Expand Up @@ -243,4 +288,4 @@
</profile>
</profiles>

</project>
</project>

0 comments on commit 93e229e

Please sign in to comment.