diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 06f7e8b..75bc717 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -51,4 +51,4 @@ jobs: prerelease: false allowUpdates: true bodyFile: CHANGELOG.md - tag: v1.0.0 + tag: v1.1.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f0a08c..0684e8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,3 @@ # CHANGELOG -- Upgrade Keycloak to version 21 -- Added CI builds -- Upgrade to Java 17 -- Used native client for api calls -- Extended base login +- Upgrade Keycloak to version 22 diff --git a/Dev.Dockerfile b/Dev.Dockerfile index 9a0dd89..18301db 100644 --- a/Dev.Dockerfile +++ b/Dev.Dockerfile @@ -1,8 +1,8 @@ -ARG TAG=21.0.1 +ARG TAG=22.0.1 FROM quay.io/keycloak/keycloak:${TAG} -ENV PHONENUMBER_LOGIN_PLUGIN_VERSION 1.0.0 +ENV PHONENUMBER_LOGIN_PLUGIN_VERSION 1.1.0 ENV KEYCLOAK_DIR /opt/keycloak ENV KC_PROXY edge diff --git a/Dockerfile b/Dockerfile index 1a788f5..cc4e924 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -ARG TAG=21.0.1 +ARG TAG=22.0.1 FROM quay.io/keycloak/keycloak:${TAG} -ENV PHONENUMBER_LOGIN_PLUGIN_VERSION 1.0.0 +ENV PHONENUMBER_LOGIN_PLUGIN_VERSION 1.1.0 ENV KEYCLOAK_DIR /opt/keycloak ENV KC_PROXY edge diff --git a/openapi/sms-open-api.yml b/openapi/sms-open-api.yml index 20851bb..b26ad30 100644 --- a/openapi/sms-open-api.yml +++ b/openapi/sms-open-api.yml @@ -9,7 +9,7 @@ info: email: dev@ssegning.com license: name: MIT - version: 1.0.0 + version: 1.1.0 externalDocs: description: Find out more about calling setting up an external service to verify phone number url: https://blog.ssegning.com diff --git a/pom.xml b/pom.xml index 3fb6cf2..1603c67 100644 --- a/pom.xml +++ b/pom.xml @@ -6,12 +6,12 @@ com.vymalo.keycloak keycloak-phonenumber-login - 1.0.0 + 1.1.0 17 1.18.26 - 21.0.1 + 22.0.1 8.13.8 2.202 1.6.9 diff --git a/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberChooseUser.java b/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberChooseUser.java index 6f56e7d..0607a3a 100644 --- a/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberChooseUser.java +++ b/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberChooseUser.java @@ -33,7 +33,7 @@ public class PhoneNumberChooseUser implements private static final Map infos = new HashMap<>(); static { - infos.put("version", "1.0.0"); + infos.put("version", "1.1.0"); final var property = new ProviderConfigProperty(); property.setName(ConfigKey.USER_PHONE_ATTRIBUTE_NAME); diff --git a/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberConfirmNumber.java b/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberConfirmNumber.java index b98a138..5e5c3c4 100644 --- a/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberConfirmNumber.java +++ b/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberConfirmNumber.java @@ -2,6 +2,8 @@ import com.google.i18n.phonenumbers.NumberParseException; import com.vymalo.keycloak.constants.PhoneKey; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; import lombok.NoArgsConstructor; import lombok.extern.jbosslog.JBossLog; import org.keycloak.Config; @@ -13,8 +15,6 @@ import org.keycloak.provider.ServerInfoAwareProviderFactory; import org.keycloak.sessions.AuthenticationSessionModel; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -36,11 +36,11 @@ public class PhoneNumberConfirmNumber implements public static final AuthenticationExecutionModel.Requirement[] REQUIREMENT_CHOICES = { AuthenticationExecutionModel.Requirement.REQUIRED }; - private static final List configProperties = new ArrayList(); + private static final List configProperties = new ArrayList<>(); private static final Map infos = new HashMap<>(); static { - infos.put("version", "1.0.0"); + infos.put("version", "1.1.0"); } @Override diff --git a/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberGetNumber.java b/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberGetNumber.java index feae132..da79fbe 100644 --- a/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberGetNumber.java +++ b/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberGetNumber.java @@ -7,6 +7,8 @@ import com.vymalo.keycloak.constants.PhoneNumberHelper; import com.vymalo.keycloak.constants.Utils; import com.vymalo.keycloak.model.CountryPhoneCode; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; import lombok.NoArgsConstructor; import lombok.extern.jbosslog.JBossLog; import org.apache.commons.lang3.StringUtils; @@ -21,8 +23,6 @@ import org.keycloak.provider.ProviderConfigProperty; import org.keycloak.provider.ServerInfoAwareProviderFactory; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -43,11 +43,11 @@ public class PhoneNumberGetNumber implements AuthenticationExecutionModel.Requirement.REQUIRED }; - private static final List configProperties = new ArrayList(); + private static final List configProperties = new ArrayList<>(); private static final Map infos = new HashMap<>(); static { - infos.put("version", "1.0.0"); + infos.put("version", "1.1.0"); ProviderConfigProperty property; @@ -63,7 +63,7 @@ public class PhoneNumberGetNumber implements private static boolean handlePreExistingUser(AuthenticationFlowContext context, UserModel existingUser) { String attrName = Utils.getConfigString(context.getAuthenticatorConfig(), ConfigKey.USER_PHONE_ATTRIBUTE_NAME, PhoneNumberHelper.DEFAULT_PHONE_KEY_NAME); final var phoneNumbers = existingUser.getAttributeStream(attrName).toList(); - if (phoneNumbers.size() >= 1) { + if (!phoneNumbers.isEmpty()) { String phoneNumber = phoneNumbers.get(0); log.debugf("Forget-password triggered when re-authenticating user after first broker login. Pre-filling request-user-phone-number screen with user's phone '%s' ", phoneNumber); @@ -138,7 +138,6 @@ public void action(AuthenticationFlowContext context) { try { number = PhoneNumberHelper.phoneNumberUtil.parse(phoneNumber, null); } catch (NumberParseException e) { - e.printStackTrace(); event.clone() .detail("phone_number", phoneNumber) .error("parse number error: " + e.getMessage()); diff --git a/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberSendTan.java b/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberSendTan.java index 90029ba..9f71f2d 100644 --- a/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberSendTan.java +++ b/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberSendTan.java @@ -37,11 +37,11 @@ public class PhoneNumberSendTan implements AuthenticationExecutionModel.Requirement.REQUIRED }; private static final Logger LOG = Logger.getLogger(PhoneNumberSendTan.class); - private static final List configProperties = new ArrayList(); + private static final List configProperties = new ArrayList<>(); private static final Map infos = new HashMap<>(); static { - infos.put("version", "1.0.0"); + infos.put("version", "1.1.0"); ProviderConfigProperty property; diff --git a/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberUpdateUser.java b/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberUpdateUser.java index 7828446..5fc4a2a 100644 --- a/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberUpdateUser.java +++ b/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberUpdateUser.java @@ -33,7 +33,7 @@ public class PhoneNumberUpdateUser implements private static final Map infos = new HashMap<>(); static { - infos.put("version", "1.0.0"); + infos.put("version", "1.1.0"); } @Override diff --git a/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberValidateTan.java b/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberValidateTan.java index 74cd7c2..3ced339 100644 --- a/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberValidateTan.java +++ b/src/main/java/com/vymalo/keycloak/authenticator/PhoneNumberValidateTan.java @@ -15,8 +15,8 @@ import org.keycloak.provider.ServerInfoAwareProviderFactory; import org.keycloak.sessions.AuthenticationSessionModel; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.core.MultivaluedMap; +import jakarta.ws.rs.core.Response; import java.util.*; @JBossLog @@ -30,11 +30,11 @@ public class PhoneNumberValidateTan implements public static final AuthenticationExecutionModel.Requirement[] REQUIREMENT_CHOICES = { AuthenticationExecutionModel.Requirement.REQUIRED }; - private static final List configProperties = new ArrayList(); + private static final List configProperties = new ArrayList<>(); private static final Map infos = new HashMap<>(); static { - infos.put("version", "1.0.0"); + infos.put("version", "1.1.0"); } @Override