range versions; increased support to v26

This commit is contained in:
Brian Long 2025-04-22 18:33:11 -04:00
parent 733cf3e1b8
commit 7a06e3fa89
32 changed files with 1020 additions and 1425 deletions

316
pom.xml
View File

@ -13,7 +13,7 @@
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<keycloak.version>${keycloak.majorVersion}.0.0</keycloak.version>
<auto-service.version>1.0</auto-service.version>
<auto-service.version>1.1.1</auto-service.version>
</properties>
<dependencies>
@ -27,21 +27,11 @@
<artifactId>keycloak-server-spi</artifactId>
<version>${keycloak.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>3.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-services</artifactId>
<version>${keycloak.version}</version>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-core</artifactId>
<version>${keycloak.version}</version>
</dependency>
<dependency>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
@ -70,23 +60,15 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>>keycloak-v${keycloak.majorVersion}</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>keycloak-v${keycloak.majorVersion}</classifier>
<archive>
<manifestEntries>
<!-- This is required in order for the classloader of this JAR to access the specified library at runtime -->
<Dependencies>org.keycloak.keycloak-services</Dependencies>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
<configuration>
<classifier>keycloak-${keycloak.version.range}</classifier>
<archive>
<manifestEntries>
<!-- This is required in order for the classloader of this JAR to access the specified library at runtime -->
<Dependencies>org.keycloak.keycloak-services</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
@ -96,6 +78,7 @@
<id>keycloak-v6</id>
<properties>
<keycloak.majorVersion>6</keycloak.majorVersion>
<keycloak.version.range>v6</keycloak.version.range>
</properties>
<build>
<plugins>
@ -104,13 +87,13 @@
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source-keycloak-v6</id>
<id>add-source</id>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>${basedir}/src/keycloak-v6-common/java</source>
<source>${basedir}/src/keycloak-v6-v11/java</source>
<source>${basedir}/src/keycloak-v6/java</source>
<source>${basedir}/src/keycloak-v6-v11/java</source>
<source>${basedir}/src/keycloak-v6-v7/java</source>
</sources>
</configuration>
</execution>
@ -123,6 +106,7 @@
<id>keycloak-v7</id>
<properties>
<keycloak.majorVersion>7</keycloak.majorVersion>
<keycloak.version.range>v7</keycloak.version.range>
</properties>
<build>
<plugins>
@ -131,13 +115,13 @@
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source-keycloak-v7</id>
<id>add-source</id>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>${basedir}/src/keycloak-v6-common/java</source>
<source>${basedir}/src/keycloak-v6-v11/java</source>
<source>${basedir}/src/keycloak-v6/java</source>
<source>${basedir}/src/keycloak-v6-v7/java</source>
<source>${basedir}/src/keycloak-v7+/java</source>
</sources>
</configuration>
</execution>
@ -147,9 +131,13 @@
</build>
</profile>
<profile>
<id>keycloak-v8</id>
<id>keycloak-v8-v11</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<keycloak.majorVersion>8</keycloak.majorVersion>
<keycloak.version.range>v8-v11</keycloak.version.range>
</properties>
<build>
<plugins>
@ -158,104 +146,14 @@
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source-keycloak-v8</id>
<id>add-source</id>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>${basedir}/src/keycloak-v6-common/java</source>
<source>${basedir}/src/keycloak-v8-common/java</source>
<source>${basedir}/src/keycloak-v6-v11/java</source>
<source>${basedir}/src/keycloak-v8/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>keycloak-v9</id>
<properties>
<keycloak.majorVersion>9</keycloak.majorVersion>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source-keycloak-v9</id>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>${basedir}/src/keycloak-v6-common/java</source>
<source>${basedir}/src/keycloak-v8-common/java</source>
<source>${basedir}/src/keycloak-v9-common/java</source>
<source>${basedir}/src/keycloak-v6-v11/java</source>
<source>${basedir}/src/keycloak-v9/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>keycloak-v10</id>
<properties>
<keycloak.majorVersion>10</keycloak.majorVersion>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source-keycloak-v10</id>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>${basedir}/src/keycloak-v6-common/java</source>
<source>${basedir}/src/keycloak-v8-common/java</source>
<source>${basedir}/src/keycloak-v9-common/java</source>
<source>${basedir}/src/keycloak-v10-common/java</source>
<source>${basedir}/src/keycloak-v6-v11/java</source>
<source>${basedir}/src/keycloak-v10/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>keycloak-v11</id>
<properties>
<keycloak.majorVersion>11</keycloak.majorVersion>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source-keycloak-v11</id>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>${basedir}/src/keycloak-v6-common/java</source>
<source>${basedir}/src/keycloak-v8-common/java</source>
<source>${basedir}/src/keycloak-v9-common/java</source>
<source>${basedir}/src/keycloak-v10-common/java</source>
<source>${basedir}/src/keycloak-v11-common/java</source>
<source>${basedir}/src/keycloak-v6-v11/java</source>
<source>${basedir}/src/keycloak-v11/java</source>
<source>${basedir}/src/keycloak-v8-v12/java</source>
<source>${basedir}/src/keycloak-v7+/java</source>
<source>${basedir}/src/keycloak-v8+/java</source>
</sources>
</configuration>
</execution>
@ -268,6 +166,7 @@
<id>keycloak-v12</id>
<properties>
<keycloak.majorVersion>12</keycloak.majorVersion>
<keycloak.version.range>v12</keycloak.version.range>
</properties>
<build>
<plugins>
@ -276,17 +175,14 @@
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source-keycloak-v12</id>
<id>add-source</id>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>${basedir}/src/keycloak-v6-common/java</source>
<source>${basedir}/src/keycloak-v8-common/java</source>
<source>${basedir}/src/keycloak-v9-common/java</source>
<source>${basedir}/src/keycloak-v10-common/java</source>
<source>${basedir}/src/keycloak-v11-common/java</source>
<source>${basedir}/src/keycloak-v12-common/java</source>
<source>${basedir}/src/keycloak-v12/java</source>
<source>${basedir}/src/keycloak-v8-v12/java</source>
<source>${basedir}/src/keycloak-v7+/java</source>
<source>${basedir}/src/keycloak-v8+/java</source>
<source>${basedir}/src/keycloak-v12+/java</source>
</sources>
</configuration>
</execution>
@ -296,9 +192,10 @@
</build>
</profile>
<profile>
<id>keycloak-v13</id>
<id>keycloak-v13-v14</id>
<properties>
<keycloak.majorVersion>13</keycloak.majorVersion>
<keycloak.version.range>v13-v14</keycloak.version.range>
</properties>
<build>
<plugins>
@ -307,18 +204,15 @@
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source-keycloak-v13</id>
<id>add-source</id>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>${basedir}/src/keycloak-v6-common/java</source>
<source>${basedir}/src/keycloak-v8-common/java</source>
<source>${basedir}/src/keycloak-v9-common/java</source>
<source>${basedir}/src/keycloak-v10-common/java</source>
<source>${basedir}/src/keycloak-v11-common/java</source>
<source>${basedir}/src/keycloak-v12-common/java</source>
<source>${basedir}/src/keycloak-v13-common/java</source>
<source>${basedir}/src/keycloak-v13/java</source>
<source>${basedir}/src/keycloak-v13-v14/java</source>
<source>${basedir}/src/keycloak-v7+/java</source>
<source>${basedir}/src/keycloak-v8+/java</source>
<source>${basedir}/src/keycloak-v12+/java</source>
<source>${basedir}/src/keycloak-v13+/java</source>
</sources>
</configuration>
</execution>
@ -328,42 +222,10 @@
</build>
</profile>
<profile>
<id>keycloak-v14</id>
<properties>
<keycloak.majorVersion>14</keycloak.majorVersion>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source-keycloak-v14</id>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>${basedir}/src/keycloak-v6-common/java</source>
<source>${basedir}/src/keycloak-v8-common/java</source>
<source>${basedir}/src/keycloak-v9-common/java</source>
<source>${basedir}/src/keycloak-v10-common/java</source>
<source>${basedir}/src/keycloak-v11-common/java</source>
<source>${basedir}/src/keycloak-v12-common/java</source>
<source>${basedir}/src/keycloak-v13-common/java</source>
<source>${basedir}/src/keycloak-v14-common/java</source>
<source>${basedir}/src/keycloak-v14/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>keycloak-v15</id>
<id>keycloak-v15-v24</id>
<properties>
<keycloak.majorVersion>15</keycloak.majorVersion>
<keycloak.version.range>v15-v24</keycloak.version.range>
</properties>
<build>
<plugins>
@ -372,20 +234,51 @@
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source-keycloak-v15</id>
<id>add-source</id>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>${basedir}/src/keycloak-v6-common/java</source>
<source>${basedir}/src/keycloak-v8-common/java</source>
<source>${basedir}/src/keycloak-v9-common/java</source>
<source>${basedir}/src/keycloak-v10-common/java</source>
<source>${basedir}/src/keycloak-v11-common/java</source>
<source>${basedir}/src/keycloak-v12-common/java</source>
<source>${basedir}/src/keycloak-v13-common/java</source>
<source>${basedir}/src/keycloak-v14-common/java</source>
<source>${basedir}/src/keycloak-v15-common/java</source>
<source>${basedir}/src/keycloak-v15/java</source>
<source>${basedir}/src/keycloak-v15-v24/java</source>
<source>${basedir}/src/keycloak-v7+/java</source>
<source>${basedir}/src/keycloak-v8+/java</source>
<source>${basedir}/src/keycloak-v12+/java</source>
<source>${basedir}/src/keycloak-v13+/java</source>
<source>${basedir}/src/keycloak-v15+/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>keycloak-v25-v26</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<keycloak.majorVersion>25</keycloak.majorVersion>
<keycloak.version.range>v25-v26</keycloak.version.range>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>${basedir}/src/keycloak-v25-v26/java</source>
<source>${basedir}/src/keycloak-v7+/java</source>
<source>${basedir}/src/keycloak-v8+/java</source>
<source>${basedir}/src/keycloak-v12+/java</source>
<source>${basedir}/src/keycloak-v13+/java</source>
<source>${basedir}/src/keycloak-v15+/java</source>
<source>${basedir}/src/keycloak-v25+/java</source>
</sources>
</configuration>
</execution>
@ -394,44 +287,5 @@
</plugins>
</build>
</profile>
<profile>
<id>keycloak-v18</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<keycloak.majorVersion>18</keycloak.majorVersion>
<java.version>1.8</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source-keycloak-v18</id>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>${basedir}/src/keycloak-v6-common/java</source>
<source>${basedir}/src/keycloak-v8-common/java</source>
<source>${basedir}/src/keycloak-v9-common/java</source>
<source>${basedir}/src/keycloak-v10-common/java</source>
<source>${basedir}/src/keycloak-v11-common/java</source>
<source>${basedir}/src/keycloak-v12-common/java</source>
<source>${basedir}/src/keycloak-v13-common/java</source>
<source>${basedir}/src/keycloak-v14-common/java</source>
<source>${basedir}/src/keycloak-v15-common/java</source>
<source>${basedir}/src/keycloak-v18-common/java</source>
<source>${basedir}/src/keycloak-v18/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -1,41 +0,0 @@
/*
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
public abstract class FakeRealmV10 extends FakeRealmV9 {
@Override
public int getClientSessionIdleTimeout() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setClientSessionIdleTimeout(int seconds) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getClientSessionMaxLifespan() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setClientSessionMaxLifespan(int seconds) {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -1,36 +0,0 @@
/*
* Copyright 2019 Julian Picht
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import org.keycloak.models.PasswordPolicy;
public class FakeRealm extends FakeRealmV10 {
private PasswordPolicy passwordPolicy;
@Override
public PasswordPolicy getPasswordPolicy() {
return passwordPolicy;
}
@Override
public void setPasswordPolicy(PasswordPolicy policy) {
passwordPolicy = policy;
}
}

View File

@ -1,41 +0,0 @@
/*
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
public abstract class FakeRealmV11 extends FakeRealmV10 {
@Override
public int getClientOfflineSessionIdleTimeout() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setClientOfflineSessionIdleTimeout(int seconds) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public int getClientOfflineSessionMaxLifespan() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setClientOfflineSessionMaxLifespan(int seconds) {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -1,36 +0,0 @@
/*
* Copyright 2019 Julian Picht
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import org.keycloak.models.PasswordPolicy;
public class FakeRealm extends FakeRealmV11 {
private PasswordPolicy passwordPolicy;
@Override
public PasswordPolicy getPasswordPolicy() {
return passwordPolicy;
}
@Override
public void setPasswordPolicy(PasswordPolicy policy) {
passwordPolicy = policy;
}
}

View File

@ -1,202 +0,0 @@
/*
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import java.util.Map;
import java.util.stream.Stream;
import org.keycloak.component.ComponentModel;
import org.keycloak.models.AuthenticationExecutionModel;
import org.keycloak.models.AuthenticationFlowModel;
import org.keycloak.models.AuthenticatorConfigModel;
import org.keycloak.models.ClientModel;
import org.keycloak.models.ClientScopeModel;
import org.keycloak.models.GroupModel;
import org.keycloak.models.IdentityProviderMapperModel;
import org.keycloak.models.IdentityProviderModel;
import org.keycloak.models.RequiredActionProviderModel;
import org.keycloak.models.RequiredCredentialModel;
import org.keycloak.models.RoleModel;
public abstract class FakeRealmV12 extends FakeRealmV11 {
@Override
public Stream<RequiredCredentialModel> getRequiredCredentialsStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<GroupModel> getDefaultGroupsStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<ClientModel> getClientsStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<ClientModel> getClientsStream(Integer firstResult, Integer maxResults) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<ClientModel> getAlwaysDisplayInConsoleClientsStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<ClientModel> searchClientByClientIdStream(String clientId, Integer firstResult, Integer maxResults) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<AuthenticationFlowModel> getAuthenticationFlowsStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<AuthenticationExecutionModel> getAuthenticationExecutionsStream(String flowId) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<AuthenticatorConfigModel> getAuthenticatorConfigsStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<RequiredActionProviderModel> getRequiredActionProvidersStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<IdentityProviderModel> getIdentityProvidersStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<IdentityProviderMapperModel> getIdentityProviderMappersStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<IdentityProviderMapperModel> getIdentityProviderMappersByAliasStream(String brokerAlias) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<ComponentModel> getComponentsStream(String parentId, String providerType) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<ComponentModel> getComponentsStream(String parentId) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<ComponentModel> getComponentsStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<String> getEventsListenersStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<String> getEnabledEventTypesStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<String> getSupportedLocalesStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<GroupModel> getGroupsStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<GroupModel> getTopLevelGroupsStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<GroupModel> getTopLevelGroupsStream(Integer first, Integer max) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<GroupModel> searchForGroupByNameStream(String search, Integer first, Integer max) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<ClientScopeModel> getClientScopesStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
public void patchRealmLocalizationTexts(String locale, Map<String, String> localizationTexts) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean removeRealmLocalizationTexts(String locale) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Map<String, Map<String, String>> getRealmLocalizationTexts() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Map<String, String> getRealmLocalizationTextsByLocale(String locale) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<ClientScopeModel> getDefaultClientScopesStream(boolean defaultScope) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<RoleModel> getRolesStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<RoleModel> getRolesStream(Integer firstResult, Integer maxResults) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<RoleModel> searchForRolesStream(String search, Integer first, Integer max) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<String> getDefaultRolesStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -1,36 +0,0 @@
/*
* Copyright 2019 Julian Picht
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import org.keycloak.models.PasswordPolicy;
public class FakeRealm extends FakeRealmV12 {
private PasswordPolicy passwordPolicy;
@Override
public PasswordPolicy getPasswordPolicy() {
return passwordPolicy;
}
@Override
public void setPasswordPolicy(PasswordPolicy policy) {
passwordPolicy = policy;
}
}

View File

@ -0,0 +1,21 @@
package com.github.jpicht.keycloak.policy;
import org.keycloak.models.CibaConfig;
import org.keycloak.models.OAuth2DeviceConfig;
/**
* This is only for methods whose signatures require Keycloak v13 or later.
*
* @author brian@inteligr8.com
*/
public interface UnsupportedRealmV13 extends UnsupportedRealmV8 {
default OAuth2DeviceConfig getOAuth2DeviceConfig() {
throw new UnsupportedOperationException("Not supported yet.");
}
default CibaConfig getCibaPolicy() {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -1,73 +0,0 @@
/*
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import java.util.stream.Stream;
import org.keycloak.models.CibaConfig;
import org.keycloak.models.ClientInitialAccessModel;
import org.keycloak.models.OAuth2DeviceConfig;
import org.keycloak.models.RoleModel;
public abstract class FakeRealmV13 extends FakeRealmV12 {
@Override
public OAuth2DeviceConfig getOAuth2DeviceConfig() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public CibaConfig getCibaPolicy() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public RoleModel getDefaultRole() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setDefaultRole(RoleModel role) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public ClientInitialAccessModel createClientInitialAccessModel(int expiration, int count) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public ClientInitialAccessModel getClientInitialAccessModel(String id) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void removeClientInitialAccessModel(String id) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Stream<ClientInitialAccessModel> getClientInitialAccesses() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void decreaseRemainingCount(ClientInitialAccessModel clientInitialAccess) {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -0,0 +1,7 @@
package com.github.jpicht.keycloak.policy;
import org.keycloak.models.PasswordPolicy;
public class FakeRealm extends PasswordPolicyRealm implements UnsupportedRealmV13 {
}

View File

@ -1,31 +0,0 @@
/*
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import java.util.Map;
import java.util.stream.Stream;
import org.keycloak.models.ClientModel;
public abstract class FakeRealmV14 extends FakeRealmV13 {
@Override
public Stream<ClientModel> searchClientByAttributes(Map<String, String> attributes, Integer firstResult, Integer maxResults) {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -1,36 +0,0 @@
/*
* Copyright 2019 Julian Picht
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import org.keycloak.models.PasswordPolicy;
public class FakeRealm extends FakeRealmV14 {
private PasswordPolicy passwordPolicy;
@Override
public PasswordPolicy getPasswordPolicy() {
return passwordPolicy;
}
@Override
public void setPasswordPolicy(PasswordPolicy policy) {
passwordPolicy = policy;
}
}

View File

@ -0,0 +1,16 @@
package com.github.jpicht.keycloak.policy;
import org.keycloak.models.ParConfig;
/**
* This is only for methods whose signatures require Keycloak v15 or later.
*
* @author brian@inteligr8.com
*/
public interface UnsupportedRealmV15 extends UnsupportedRealmV13 {
default ParConfig getParPolicy() {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -1,28 +0,0 @@
/*
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import org.keycloak.models.ParConfig;
public abstract class FakeRealmV15 extends FakeRealmV14 {
@Override
public ParConfig getParPolicy() {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -0,0 +1,5 @@
package com.github.jpicht.keycloak.policy;
public class FakeRealm extends PasswordPolicyRealm implements UnsupportedRealmV15 {
}

View File

@ -1,36 +0,0 @@
/*
* Copyright 2019 Julian Picht
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import org.keycloak.models.PasswordPolicy;
public class FakeRealm extends FakeRealmV15 {
private PasswordPolicy passwordPolicy;
@Override
public PasswordPolicy getPasswordPolicy() {
return passwordPolicy;
}
@Override
public void setPasswordPolicy(PasswordPolicy policy) {
passwordPolicy = policy;
}
}

View File

@ -1,30 +0,0 @@
/*
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import org.keycloak.models.ParConfig;
import java.util.Map;
public class FakeRealmV18 extends FakeRealmV15 {
@Override
public void createOrUpdateRealmLocalizationTexts(String locale, Map<String, String> localizationTexts) {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -0,0 +1,34 @@
package com.github.jpicht.keycloak.policy;
import java.util.stream.Stream;
import org.keycloak.models.RequiredActionConfigModel;
/**
* This is only for methods whose signatures require Keycloak v25 or later.
*
* @author brian@inteligr8.com
*/
public interface UnsupportedRealmV25 extends UnsupportedRealmV15 {
default RequiredActionConfigModel getRequiredActionConfigById(String id) {
throw new UnsupportedOperationException("Not supported yet.");
}
default RequiredActionConfigModel getRequiredActionConfigByAlias(String alias) {
throw new UnsupportedOperationException("Not supported yet.");
}
default Stream<RequiredActionConfigModel> getRequiredActionConfigsStream() {
throw new UnsupportedOperationException("Not supported yet.");
}
default void updateRequiredActionConfig(RequiredActionConfigModel model) {
throw new UnsupportedOperationException("Not supported yet.");
}
default void removeRequiredActionProviderConfig(RequiredActionConfigModel model) {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -0,0 +1,5 @@
package com.github.jpicht.keycloak.policy;
public class FakeRealm extends PasswordPolicyRealm implements UnsupportedRealmV25 {
}

View File

@ -0,0 +1,7 @@
package com.github.jpicht.keycloak.policy;
import org.keycloak.models.PasswordPolicy;
public class FakeRealm extends PasswordPolicyRealm implements UnsupportedRealm {
}

View File

@ -1,36 +0,0 @@
/*
* Copyright 2019 Julian Picht
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import org.keycloak.models.PasswordPolicy;
public class FakeRealm extends FakeRealmV6 {
private PasswordPolicy passwordPolicy;
@Override
public PasswordPolicy getPasswordPolicy() {
return passwordPolicy;
}
@Override
public void setPasswordPolicy(PasswordPolicy policy) {
passwordPolicy = policy;
}
}

View File

@ -0,0 +1,90 @@
/*
* Copyright 2021 Brian Long
*
* 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 com.github.jpicht.keycloak.policy;
import java.util.concurrent.TimeUnit;
import org.jboss.logging.Logger;
import org.keycloak.authentication.RequiredActionContext;
import org.keycloak.authentication.RequiredActionProvider;
import org.keycloak.common.util.Time;
import org.keycloak.credential.CredentialModel;
import org.keycloak.credential.CredentialProvider;
import org.keycloak.credential.PasswordCredentialProvider;
import org.keycloak.credential.PasswordCredentialProviderFactory;
import org.keycloak.models.RealmModel;
import org.keycloak.models.UserModel;
/**
* @author brian@inteligr8.com
*/
abstract class RequiredActionMultiplexer implements RequiredActionProvider {
private final Logger logger = Logger.getLogger(RequiredActionMultiplexer.class);
protected abstract int findDaysToExpire(RealmModel realm, UserModel user);
/**
* This is a re-implementation of what is found in the default
* implementation in Keycloak. It just makes days-to-expire abstract so it
* can be implemented any number of ways.
*
* https://github.com/keycloak/keycloak/blob/af3b573d196af882dfb25cdccb98361746e85481/services/src/main/java/org/keycloak/authentication/requiredactions/UpdatePassword.java#L67
*/
@Override
public void evaluateTriggers(RequiredActionContext context) {
this.logger.tracef("evaluateTriggers(%s)", context.getUser() != null ? context.getUser().getUsername() : null);
int daysToExpirePassword = this.findDaysToExpire(context.getRealm(), context.getUser());
if (daysToExpirePassword > -1) {
this.logger.debugf("Found password expiration: %d days", daysToExpirePassword);
PasswordCredentialProvider passwordProvider = (PasswordCredentialProvider)context.getSession()
.getProvider(CredentialProvider.class, PasswordCredentialProviderFactory.PROVIDER_ID);
CredentialModel password = passwordProvider.getPassword(context.getRealm(), context.getUser());
if (password != null) {
this.logger.tracef("Found password credentials; created: %d ms", password.getCreatedDate());
if(password.getCreatedDate() == null) {
context.getUser().addRequiredAction(UserModel.RequiredAction.UPDATE_PASSWORD);
this.logger.debug("User is required to update password");
} else {
long timeElapsed = Time.currentTimeMillis() - password.getCreatedDate();
long timeToExpire = TimeUnit.DAYS.toMillis(daysToExpirePassword);
if(timeElapsed > timeToExpire) {
context.getUser().addRequiredAction(UserModel.RequiredAction.UPDATE_PASSWORD);
this.logger.debug("User is required to update password");
} else {
this.logger.tracef("Password credentials expire in %d ms", timeToExpire);
}
}
}
}
}
@Override
public void requiredActionChallenge(RequiredActionContext context) {
this.logger.tracef("requiredActionChallenge(%s)", context.getUser() != null ? context.getUser().getUsername() : null);
}
@Override
public void processAction(RequiredActionContext context) {
this.logger.tracef("processAction(%s)", context.getUser() != null ? context.getUser().getUsername() : null);
}
}

View File

@ -0,0 +1,38 @@
package com.github.jpicht.keycloak.policy;
import org.keycloak.models.WebAuthnPolicy;
/**
* This is only for methods whose signatures require Keycloak v8 or later.
*
* @author brian@inteligr8.com
*/
public interface UnsupportedRealmV8 extends UnsupportedRealm {
/**
* Added in Keycloak v8
*/
default WebAuthnPolicy getWebAuthnPolicy() {
throw new UnsupportedOperationException("Not supported yet.");
}
default void setWebAuthnPolicy(WebAuthnPolicy policy) {
throw new UnsupportedOperationException("Not supported yet.");
}
/**
* Added in Keycloak v9
*/
default WebAuthnPolicy getWebAuthnPolicyPasswordless() {
throw new UnsupportedOperationException("Not supported yet.");
}
default void setWebAuthnPolicyPasswordless(WebAuthnPolicy policy) {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -1,39 +0,0 @@
/*
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import org.keycloak.models.AuthenticationExecutionModel;
import org.keycloak.models.WebAuthnPolicy;
public abstract class FakeRealmV8 extends FakeRealmV6 {
@Override
public WebAuthnPolicy getWebAuthnPolicy() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setWebAuthnPolicy(WebAuthnPolicy policy) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public AuthenticationExecutionModel getAuthenticationExecutionByFlowId(String flowId) {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -0,0 +1,7 @@
package com.github.jpicht.keycloak.policy;
import org.keycloak.models.PasswordPolicy;
public class FakeRealm extends PasswordPolicyRealm implements UnsupportedRealmV8 {
}

View File

@ -1,36 +0,0 @@
/*
* Copyright 2019 Julian Picht
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import org.keycloak.models.PasswordPolicy;
public class FakeRealm extends FakeRealmV8 {
private PasswordPolicy passwordPolicy;
@Override
public PasswordPolicy getPasswordPolicy() {
return passwordPolicy;
}
@Override
public void setPasswordPolicy(PasswordPolicy policy) {
passwordPolicy = policy;
}
}

View File

@ -1,74 +0,0 @@
/*
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import java.util.List;
import java.util.Set;
import org.keycloak.models.ClientModel;
import org.keycloak.models.GroupModel;
import org.keycloak.models.RoleModel;
import org.keycloak.models.WebAuthnPolicy;
public abstract class FakeRealmV9 extends FakeRealmV8 {
@Override
public WebAuthnPolicy getWebAuthnPolicyPasswordless() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void setWebAuthnPolicyPasswordless(WebAuthnPolicy policy) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<ClientModel> getClients(Integer firstResult, Integer maxResults) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Long getClientsCount() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<ClientModel> getAlwaysDisplayInConsoleClients() {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<ClientModel> searchClientByClientId(String clientId, Integer firstResult, Integer maxResults) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public GroupModel createGroup(String id, String name, GroupModel toParent) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Set<RoleModel> getRoles(Integer firstResult, Integer maxResults) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public Set<RoleModel> searchForRoles(String search, Integer first, Integer max) {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -1,36 +0,0 @@
/*
* Copyright 2019 Julian Picht
* Copyright 2021 Brian Long (brian@inteligr8.com)
*
* 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 com.github.jpicht.keycloak.policy;
import org.keycloak.models.PasswordPolicy;
public class FakeRealm extends FakeRealmV9 {
private PasswordPolicy passwordPolicy;
@Override
public PasswordPolicy getPasswordPolicy() {
return passwordPolicy;
}
@Override
public void setPasswordPolicy(PasswordPolicy policy) {
passwordPolicy = policy;
}
}

View File

@ -19,7 +19,7 @@ package com.github.jpicht.keycloak.policy;
import org.keycloak.models.PasswordPolicy;
public class FakeRealm extends FakeRealmV13 {
public abstract class PasswordPolicyRealm implements UnsupportedRealm {
private PasswordPolicy passwordPolicy;