diff --git a/.classpath b/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..90f81edf36ba828a5eefd00c5499d924308a01e9 --- /dev/null +++ b/.classpath @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" output="target/classes" path="src/main/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="target/test-classes" path="src/test/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + <attribute name="test" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + <attribute name="test" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/.project b/.project new file mode 100644 index 0000000000000000000000000000000000000000..5b9275b8e5380c0199448b52eeefb8228351a170 --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>bartuli-project</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + </natures> +</projectDescription> diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000000000000000000000000000000000..99f26c0203a7844de00dbfc56e6a35d8ed3c022c --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..5723a0f871a11b2b71a38acae12a3dba120a00c6 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..f897a7f1cb2389f85fe6381425d29f0a9866fb65 --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/choose-initial/.classpath b/choose-initial/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..0fb79cfe69b2c407027c6a76a12fc59553c9e195 --- /dev/null +++ b/choose-initial/.classpath @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" output="target/classes" path="src/main/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="target/test-classes" path="src/test/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + <attribute name="test" value="true"/> + </attributes> + </classpathentry> + <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + <attribute name="test" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/choose-initial/.project b/choose-initial/.project new file mode 100644 index 0000000000000000000000000000000000000000..cda089733583aeba40332821c9fb57e460e04bf2 --- /dev/null +++ b/choose-initial/.project @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>choose-initial</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + </natures> +</projectDescription> diff --git a/choose-initial/.settings/org.eclipse.core.resources.prefs b/choose-initial/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000000000000000000000000000000000..29abf999564110a0d6aca109f55f439c72b7031c --- /dev/null +++ b/choose-initial/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/<project>=UTF-8 diff --git a/choose-initial/.settings/org.eclipse.jdt.core.prefs b/choose-initial/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..2af1e7b99c98d3fc61561c085022741062a7820e --- /dev/null +++ b/choose-initial/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/choose-initial/.settings/org.eclipse.m2e.core.prefs b/choose-initial/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..f897a7f1cb2389f85fe6381425d29f0a9866fb65 --- /dev/null +++ b/choose-initial/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/choose-initial/.settings/org.jboss.ide.eclipse.as.core.prefs b/choose-initial/.settings/org.jboss.ide.eclipse.as.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..cf3aa3a9d289d3746cc7265fd1e97a51f0f904ef --- /dev/null +++ b/choose-initial/.settings/org.jboss.ide.eclipse.as.core.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.jboss.ide.eclipse.as.core.singledeployable.deployableList= diff --git a/choose-initial/pom.xml b/choose-initial/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..33909c1f60ef3927900483f9d8ce04a829ce3487 --- /dev/null +++ b/choose-initial/pom.xml @@ -0,0 +1,81 @@ +<!-- + ~ Copyright 2016 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. + --> + +<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>bartuli-project</artifactId> + <groupId>de.puzzle-itc.keycloak</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <name>Choose Initial Authenticator Required Action</name> + <description/> + <modelVersion>4.0.0</modelVersion> + + <artifactId>choose-initial</artifactId> + <packaging>jar</packaging> + + <dependencies> + <dependency> + <groupId>org.keycloak</groupId> + <artifactId>keycloak-core</artifactId> + <scope>provided</scope> + <version>${keycloak.version}</version> + </dependency> + <dependency> + <groupId>org.keycloak</groupId> + <artifactId>keycloak-server-spi</artifactId> + <scope>provided</scope> + <version>${keycloak.version}</version> + </dependency> + <dependency> + <groupId>org.keycloak</groupId> + <artifactId>keycloak-server-spi-private</artifactId> + <scope>provided</scope> + <version>${keycloak.version}</version> + </dependency> + <dependency> + <groupId>org.jboss.logging</groupId> + <artifactId>jboss-logging</artifactId> + <scope>provided</scope> + <version>3.4.1.Final</version> + </dependency> + <dependency> + <groupId>org.keycloak</groupId> + <artifactId>keycloak-services</artifactId> + <scope>provided</scope> + <version>${keycloak.version}</version> + </dependency> + </dependencies> + + <build> + <finalName>choose-initial-authenticator-required-action</finalName> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${maven-surefire-plugin.version}</version> + <configuration> + <excludes> + <exclude>**/*IntegrationTest.java</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/choose-initial/src/main/java/de/puzzleitc/keycloak/auth/requiredactions/ChooseInitialRequiredAction.java b/choose-initial/src/main/java/de/puzzleitc/keycloak/auth/requiredactions/ChooseInitialRequiredAction.java new file mode 100644 index 0000000000000000000000000000000000000000..5b8937182201c6f7c1a9ec868e55254445974c2d --- /dev/null +++ b/choose-initial/src/main/java/de/puzzleitc/keycloak/auth/requiredactions/ChooseInitialRequiredAction.java @@ -0,0 +1,121 @@ +/* + * Copyright 2016 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 de.puzzleitc.keycloak.auth.requiredactions; + +import org.keycloak.authentication.RequiredActionContext; +import org.keycloak.authentication.RequiredActionProvider; +import org.keycloak.credential.CredentialProvider; +import org.keycloak.credential.CredentialTypeMetadata; +import org.keycloak.credential.CredentialTypeMetadataContext; +import org.keycloak.models.KeycloakSession; +import org.keycloak.models.RealmModel; +import org.keycloak.models.UserModel; + +import java.util.List; +import java.util.Objects; +import java.util.function.Supplier; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import javax.ws.rs.core.Response; + +/** + * Wenn der User einen Authenticator der Kategorie TWO-FACTOR bereits + * konfiguriert hat kann die required action direkt als abgeschlossen gesetzt + * und verlassen werden, sonst wird das Formular zur Auswahl erzeugt und die + * challenge Response an den User weitergeben. + * + * @author Alexander Bartuli + */ +public class ChooseInitialRequiredAction implements RequiredActionProvider { + + public static final String PROVIDER_ID = "choose_initial_required_action"; + + @Override + public void evaluateTriggers(RequiredActionContext context) { + + } + + @Override + public void requiredActionChallenge(RequiredActionContext context) { + + KeycloakSession session = context.getSession(); + RealmModel realm = context.getRealm(); + UserModel user = context.getUser(); + + // Ein Stream Supplier für CredentialProvider der Category TWO-FACTOR + Supplier<Stream<CredentialProvider>> twoFactorProvidersSupplier = () -> session.getKeycloakSessionFactory() + .getProviderFactoriesStream(CredentialProvider.class) + .map(providerFactory -> session.getProvider(CredentialProvider.class, providerFactory.getId())) + .filter(provider -> Objects.equals( + provider.getCredentialTypeMetadata(CredentialTypeMetadataContext.builder().build(session)) + .getCategory(), + CredentialTypeMetadata.Category.TWO_FACTOR)); + + // Ein Boolean, der true ist, sobald ein CredentialProvider der Kategorie + // TWO-FACTOR für den User konfiguriert ist + boolean hasTwoFactorCategoryConfigured = twoFactorProvidersSupplier.get() + .anyMatch(provider -> session.userCredentialManager().isConfiguredFor(realm, user, provider.getType())); + + // Eine Liste aller CredentialTypeMetadata der CredentialProvider der Kategorie + // TWO-FACTOR + List<CredentialTypeMetadata> twoFactorProviderCredentialTypeMetadata = twoFactorProvidersSupplier.get().map( + provider -> provider.getCredentialTypeMetadata(CredentialTypeMetadataContext.builder().build(session))) + .collect(Collectors.toList()); + + if (hasTwoFactorCategoryConfigured) { + + context.success(); + + } else { + + Response challenge = context.form().setAttribute("twoFactors", twoFactorProviderCredentialTypeMetadata) + .createForm("choose-initial.ftl"); + context.challenge(challenge); + + } + } + + @Override + public void processAction(RequiredActionContext context) { + UserModel user = context.getUser(); + String choosenProviderId = (context.getHttpRequest().getDecodedFormParameters().getFirst("choosenProviderId")); + +// user.removeRequiredAction(UserModel.RequiredAction.CONFIGURE_TOTP.name()); +// user.removeRequiredAction("webauthn-register"); + + if (choosenProviderId != null) { + + user.addRequiredAction(choosenProviderId); + + } else { + + Response challenge = context.form().setError("No Option Selected").createForm("choose-initial.ftl"); + context.challenge(challenge); + return; + + } + + context.success(); + } + + @Override + public void close() { + + } +} diff --git a/choose-initial/src/main/java/de/puzzleitc/keycloak/auth/requiredactions/ChooseInitialRequiredActionFactory.java b/choose-initial/src/main/java/de/puzzleitc/keycloak/auth/requiredactions/ChooseInitialRequiredActionFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..eeef2fcebd5dd8c4d630386afdfc4cd92341d5eb --- /dev/null +++ b/choose-initial/src/main/java/de/puzzleitc/keycloak/auth/requiredactions/ChooseInitialRequiredActionFactory.java @@ -0,0 +1,61 @@ +/* + * Copyright 2016 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 de.puzzleitc.keycloak.auth.requiredactions; + +import org.keycloak.Config; +import org.keycloak.authentication.RequiredActionFactory; +import org.keycloak.authentication.RequiredActionProvider; +import org.keycloak.models.KeycloakSession; +import org.keycloak.models.KeycloakSessionFactory; + + +public class ChooseInitialRequiredActionFactory implements RequiredActionFactory { + + private static final ChooseInitialRequiredAction SINGLETON = new ChooseInitialRequiredAction(); + + @Override + public RequiredActionProvider create(KeycloakSession session) { + return SINGLETON; + } + + @Override + public String getId() { + return ChooseInitialRequiredAction.PROVIDER_ID; + } + + @Override + public String getDisplayText() { + return "Choose Initial 2FA Authenticator"; + } + + @Override + public void init(Config.Scope config) { + + } + + @Override + public void postInit(KeycloakSessionFactory factory) { + + } + + @Override + public void close() { + + } + +} diff --git a/choose-initial/src/main/resources/META-INF/services/org.keycloak.authentication.RequiredActionFactory b/choose-initial/src/main/resources/META-INF/services/org.keycloak.authentication.RequiredActionFactory new file mode 100644 index 0000000000000000000000000000000000000000..a010974870420810fa1590e6a6e8775ed59fbd01 --- /dev/null +++ b/choose-initial/src/main/resources/META-INF/services/org.keycloak.authentication.RequiredActionFactory @@ -0,0 +1,18 @@ +# +# Copyright 2016 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. +# + +de.puzzleitc.keycloak.auth.requiredactions.ChooseInitialRequiredActionFactory \ No newline at end of file diff --git a/choose-initial/src/main/resources/theme-resources/templates/choose-initial.ftl b/choose-initial/src/main/resources/theme-resources/templates/choose-initial.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e14a195e196e680fed43398a20b696bc83d32296 --- /dev/null +++ b/choose-initial/src/main/resources/theme-resources/templates/choose-initial.ftl @@ -0,0 +1,45 @@ +<#import "template.ftl" as layout> +<@layout.registrationLayout displayInfo=true; section> + <#if section = "header" || section = "show-username"> + <script type="text/javascript"> + function fillAndSubmit(choosenProviderId) { + document.getElementById('choosenProvider').value = choosenProviderId; + document.getElementById('kc-select-credential-form').submit(); + } + </script> + <#if section = "header"> + SELECT AUTHENTICATOR TO SETUP + </#if> + <#elseif section = "form"> + <form id="kc-select-credential-form" class="${properties.kcFormClass!}" action="${url.loginAction}" method="post"> + + <div class="${properties.kcSelectAuthListClass!}"> + + <#list twoFactors as twoFactor> + <div class="${properties.kcSelectAuthListItemClass!}" onclick="fillAndSubmit('${twoFactor.createAction}')"> + + <div class="${properties.kcSelectAuthListItemIconClass!}"> + <i class="${properties['${twoFactor.iconCssClass}']!authenticationSelection.iconCssClass} fa-2x"></i> + </div> + <div class="${properties.kcSelectAuthListItemBodyClass!}"> + <div class="${properties.kcSelectAuthListItemHeadingClass!}"> + ${msg('${twoFactor.displayName}')} + </div> + <div class="${properties.kcSelectAuthListItemDescriptionClass!}"> + ${msg('${twoFactor.helpText}')} + </div> + </div> + <div class="${properties.kcSelectAuthListItemFillClass!}"></div> + <div class="${properties.kcSelectAuthListItemArrowClass!}"> + <i class="${properties.kcSelectAuthListItemArrowIconClass!}"></i> + </div> + </div> + </#list> + + <input type="hidden" id="choosenProvider" name="choosenProviderId" /> + + </div> + + </form> + </#if> +</@layout.registrationLayout> \ No newline at end of file diff --git a/choose-initial/target/choose-initial-authenticator-required-action.jar b/choose-initial/target/choose-initial-authenticator-required-action.jar new file mode 100644 index 0000000000000000000000000000000000000000..2a7e409f7349e4a4573aa3afe34a8f21ac5883d5 Binary files /dev/null and b/choose-initial/target/choose-initial-authenticator-required-action.jar differ diff --git a/choose-initial/target/classes/META-INF/services/org.keycloak.authentication.RequiredActionFactory b/choose-initial/target/classes/META-INF/services/org.keycloak.authentication.RequiredActionFactory new file mode 100644 index 0000000000000000000000000000000000000000..a010974870420810fa1590e6a6e8775ed59fbd01 --- /dev/null +++ b/choose-initial/target/classes/META-INF/services/org.keycloak.authentication.RequiredActionFactory @@ -0,0 +1,18 @@ +# +# Copyright 2016 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. +# + +de.puzzleitc.keycloak.auth.requiredactions.ChooseInitialRequiredActionFactory \ No newline at end of file diff --git a/choose-initial/target/classes/de/puzzleitc/keycloak/auth/requiredactions/ChooseInitialRequiredAction.class b/choose-initial/target/classes/de/puzzleitc/keycloak/auth/requiredactions/ChooseInitialRequiredAction.class new file mode 100644 index 0000000000000000000000000000000000000000..d34df1546832523259a85deeea6c72aae27aca4a Binary files /dev/null and b/choose-initial/target/classes/de/puzzleitc/keycloak/auth/requiredactions/ChooseInitialRequiredAction.class differ diff --git a/choose-initial/target/classes/de/puzzleitc/keycloak/auth/requiredactions/ChooseInitialRequiredActionFactory.class b/choose-initial/target/classes/de/puzzleitc/keycloak/auth/requiredactions/ChooseInitialRequiredActionFactory.class new file mode 100644 index 0000000000000000000000000000000000000000..fae5751535270b43042645abd5eb3ff80e00a2e0 Binary files /dev/null and b/choose-initial/target/classes/de/puzzleitc/keycloak/auth/requiredactions/ChooseInitialRequiredActionFactory.class differ diff --git a/choose-initial/target/classes/theme-resources/templates/choose-initial.ftl b/choose-initial/target/classes/theme-resources/templates/choose-initial.ftl new file mode 100644 index 0000000000000000000000000000000000000000..e14a195e196e680fed43398a20b696bc83d32296 --- /dev/null +++ b/choose-initial/target/classes/theme-resources/templates/choose-initial.ftl @@ -0,0 +1,45 @@ +<#import "template.ftl" as layout> +<@layout.registrationLayout displayInfo=true; section> + <#if section = "header" || section = "show-username"> + <script type="text/javascript"> + function fillAndSubmit(choosenProviderId) { + document.getElementById('choosenProvider').value = choosenProviderId; + document.getElementById('kc-select-credential-form').submit(); + } + </script> + <#if section = "header"> + SELECT AUTHENTICATOR TO SETUP + </#if> + <#elseif section = "form"> + <form id="kc-select-credential-form" class="${properties.kcFormClass!}" action="${url.loginAction}" method="post"> + + <div class="${properties.kcSelectAuthListClass!}"> + + <#list twoFactors as twoFactor> + <div class="${properties.kcSelectAuthListItemClass!}" onclick="fillAndSubmit('${twoFactor.createAction}')"> + + <div class="${properties.kcSelectAuthListItemIconClass!}"> + <i class="${properties['${twoFactor.iconCssClass}']!authenticationSelection.iconCssClass} fa-2x"></i> + </div> + <div class="${properties.kcSelectAuthListItemBodyClass!}"> + <div class="${properties.kcSelectAuthListItemHeadingClass!}"> + ${msg('${twoFactor.displayName}')} + </div> + <div class="${properties.kcSelectAuthListItemDescriptionClass!}"> + ${msg('${twoFactor.helpText}')} + </div> + </div> + <div class="${properties.kcSelectAuthListItemFillClass!}"></div> + <div class="${properties.kcSelectAuthListItemArrowClass!}"> + <i class="${properties.kcSelectAuthListItemArrowIconClass!}"></i> + </div> + </div> + </#list> + + <input type="hidden" id="choosenProvider" name="choosenProviderId" /> + + </div> + + </form> + </#if> +</@layout.registrationLayout> \ No newline at end of file diff --git a/choose-initial/target/maven-archiver/pom.properties b/choose-initial/target/maven-archiver/pom.properties new file mode 100644 index 0000000000000000000000000000000000000000..60c4188d1e73b426adf8d08c6e46853c118154f5 --- /dev/null +++ b/choose-initial/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Tue Jan 25 20:35:49 CET 2022 +groupId=de.puzzle-itc.keycloak +artifactId=choose-initial +version=0.0.1-SNAPSHOT diff --git a/choose-initial/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/choose-initial/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..24dacc1c32ae45986e937ad88317c3db087450bf --- /dev/null +++ b/choose-initial/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,2 @@ +de\puzzleitc\keycloak\auth\requiredactions\ChooseInitialRequiredAction.class +de\puzzleitc\keycloak\auth\requiredactions\ChooseInitialRequiredActionFactory.class diff --git a/choose-initial/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/choose-initial/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..d65d1ac2eea6c496b2f9d348be3b88b2b5826a16 --- /dev/null +++ b/choose-initial/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,2 @@ +C:\Users\Bartu\git\choose-initial\choose-initial\src\main\java\de\puzzleitc\keycloak\auth\requiredactions\ChooseInitialRequiredActionFactory.java +C:\Users\Bartu\git\choose-initial\choose-initial\src\main\java\de\puzzleitc\keycloak\auth\requiredactions\ChooseInitialRequiredAction.java diff --git a/choose-initial/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/choose-initial/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..2d4376c76559727e78dafffc14dcfbd8c5d04e3a --- /dev/null +++ b/pom.xml @@ -0,0 +1,33 @@ +<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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>de.puzzle-itc.keycloak</groupId> + <artifactId>bartuli-project</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>auswahl</name> + <packaging>pom</packaging> + + <modules> + <module>extensions</module> + <module>secret-question</module> + <module>ChooseInitial</module> + <module>choose-initial</module> + </modules> + + <properties> + <!-- general settings --> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <java.version>11</java.version> + <maven.compiler.source>${java.version}</maven.compiler.source> + <maven.compiler.target>${java.version}</maven.compiler.target> + + <keycloak.version>16.1.0</keycloak.version> + + <!-- Tooling --> + <auto-service.version>1.0.1</auto-service.version> + <lombok.version>1.18.22</lombok.version> + <docker-maven-plugin.version>0.36.1</docker-maven-plugin.version> + <maven-failsafe-plugin.version>2.22.2</maven-failsafe-plugin.version> + <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version> + </properties> +</project> \ No newline at end of file