-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
234 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Remote Debugger AdminUI" type="Remote"> | ||
<module name="admin-ui" /> | ||
<option name="USE_SOCKET_TRANSPORT" value="true" /> | ||
<option name="SERVER_MODE" value="false" /> | ||
<option name="SHMEM_ADDRESS" /> | ||
<option name="HOST" value="localhost" /> | ||
<option name="PORT" value="8787" /> | ||
<option name="AUTO_RESTART" value="false" /> | ||
<RunnerSettings RunnerId="Debug"> | ||
<option name="DEBUG_PORT" value="8787" /> | ||
<option name="LOCAL" value="false" /> | ||
</RunnerSettings> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>dasniko.keycloak</groupId> | ||
<artifactId>keycloak-extensions-demo</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>admin-ui</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.keycloak</groupId> | ||
<artifactId>keycloak-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.keycloak</groupId> | ||
<artifactId>keycloak-server-spi</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.keycloak</groupId> | ||
<artifactId>keycloak-server-spi-private</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.keycloak</groupId> | ||
<artifactId>keycloak-services</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.auto.service</groupId> | ||
<artifactId>auto-service</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>${project.groupId}-${project.artifactId}</finalName> | ||
</build> | ||
|
||
</project> |
78 changes: 78 additions & 0 deletions
78
admin-ui/src/main/java/dasniko/keycloak/adminui/AdminUiPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright 2024 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package dasniko.keycloak.adminui; | ||
|
||
import com.google.auto.service.AutoService; | ||
import org.keycloak.Config; | ||
import org.keycloak.component.ComponentModel; | ||
import org.keycloak.models.KeycloakSessionFactory; | ||
import org.keycloak.provider.ProviderConfigProperty; | ||
import org.keycloak.provider.ProviderConfigurationBuilder; | ||
import org.keycloak.services.ui.extend.UiPageProvider; | ||
import org.keycloak.services.ui.extend.UiPageProviderFactory; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Implements UiPageProvider so it will be a master detail view in the admin ui of TODO items | ||
*/ | ||
@AutoService(UiPageProviderFactory.class) | ||
public class AdminUiPage implements UiPageProvider, UiPageProviderFactory<ComponentModel> { | ||
|
||
@Override | ||
public void init(Config.Scope config) { | ||
} | ||
|
||
@Override | ||
public void postInit(KeycloakSessionFactory factory) { | ||
} | ||
|
||
@Override | ||
public void close() { | ||
} | ||
|
||
@Override | ||
public String getId() { | ||
return "Todo"; | ||
} | ||
|
||
@Override | ||
public String getHelpText() { | ||
return "Here you can store your Todo items"; | ||
} | ||
|
||
@Override | ||
public List<ProviderConfigProperty> getConfigProperties() { | ||
return ProviderConfigurationBuilder.create() | ||
.property() | ||
.name("name") | ||
.label("Name") | ||
.helpText("Short name of the task") | ||
.type(ProviderConfigProperty.STRING_TYPE) | ||
.add().property() | ||
.name("description") | ||
.label("Description") | ||
.helpText("Description of what needs to be done") | ||
.type(ProviderConfigProperty.TEXT_TYPE) | ||
.add().property() | ||
.name("prio") | ||
.label("Priority") | ||
.type(ProviderConfigProperty.LIST_TYPE) | ||
.options("critical", "high priority", "neutral", "low priority", "unknown") | ||
.add().build(); | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
admin-ui/src/main/java/dasniko/keycloak/adminui/ThemeUiTab.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* | ||
* Copyright 2024 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package dasniko.keycloak.adminui; | ||
|
||
import com.google.auto.service.AutoService; | ||
import org.keycloak.Config; | ||
import org.keycloak.component.ComponentModel; | ||
import org.keycloak.models.KeycloakSession; | ||
import org.keycloak.models.KeycloakSessionFactory; | ||
import org.keycloak.models.RealmModel; | ||
import org.keycloak.provider.ProviderConfigProperty; | ||
import org.keycloak.provider.ProviderConfigurationBuilder; | ||
import org.keycloak.services.ui.extend.UiTabProvider; | ||
import org.keycloak.services.ui.extend.UiTabProviderFactory; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@AutoService(UiTabProviderFactory.class) | ||
public class ThemeUiTab implements UiTabProvider, UiTabProviderFactory<ComponentModel> { | ||
|
||
@Override | ||
public String getId() { | ||
return "Attributes"; | ||
} | ||
|
||
@Override | ||
public String getHelpText() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void init(Config.Scope config) { | ||
} | ||
|
||
@Override | ||
public void postInit(KeycloakSessionFactory factory) { | ||
} | ||
|
||
@Override | ||
public void close() { | ||
} | ||
|
||
@Override | ||
public void onCreate(KeycloakSession session, RealmModel realm, ComponentModel model) { | ||
realm.setAttribute("logo", model.get("logo")); | ||
} | ||
|
||
@Override | ||
public List<ProviderConfigProperty> getConfigProperties() { | ||
final ProviderConfigurationBuilder builder = ProviderConfigurationBuilder.create(); | ||
builder.property() | ||
.name("logo") | ||
.label("Set a logo") | ||
.helpText("This logo will be shown on the account ui") | ||
.type(ProviderConfigProperty.STRING_TYPE) | ||
.add(); | ||
return builder.build(); | ||
} | ||
|
||
@Override | ||
public String getPath() { | ||
return "/:realm/realm-settings/:tab?"; | ||
} | ||
|
||
@Override | ||
public Map<String, String> getParams() { | ||
Map<String, String> params = new HashMap<>(); | ||
params.put("tab", "attributes"); | ||
return params; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters