This is an automated email from the ASF dual-hosted git repository.

sgarofalo pushed a commit to branch 4_0_X
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/4_0_X by this push:
     new c21fe8c199 [SYNCOPE-1902] Manage URI type for unauthorizedRedirectUrl 
of Access Policy (#1151)
c21fe8c199 is described below

commit c21fe8c199b1dd5db5f27b1037c2ae36908aa554
Author: Samuel Garofalo <72073457+samuelg...@users.noreply.github.com>
AuthorDate: Tue Aug 5 12:45:35 2025 +0200

    [SYNCOPE-1902] Manage URI type for unauthorizedRedirectUrl of Access Policy 
(#1151)
---
 .../syncope/client/console/panels/BeanPanel.java   | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git 
a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java
 
b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java
index f030a86765..7597ad0ff3 100644
--- 
a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java
+++ 
b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java
@@ -25,6 +25,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import java.io.Serializable;
 import java.lang.reflect.Field;
 import java.lang.reflect.ParameterizedType;
+import java.net.URI;
 import java.time.Duration;
 import java.time.LocalDateTime;
 import java.time.OffsetDateTime;
@@ -76,6 +77,7 @@ import org.apache.wicket.model.PropertyModel;
 import org.apache.wicket.model.ResourceModel;
 import org.apache.wicket.model.util.ListModel;
 import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.apache.wicket.validation.validator.UrlValidator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanWrapper;
@@ -326,6 +328,26 @@ public class BeanPanel<T extends Serializable> extends 
Panel {
                     PropertyResolver.setValue(fieldName, bean, 
Duration.parse(object), prc);
                 }
             });
+        } else if (URI.class.equals(type)) {
+            panel = new AjaxTextFieldPanel(id, fieldName, new IModel<>() {
+
+                private static final long serialVersionUID = 
-608076080746590282L;
+
+                @Override
+                public String getObject() {
+                    return 
Optional.ofNullable(PropertyResolver.getValue(fieldName, bean)).
+                            map(o -> ((URI) o).toASCIIString()).orElse(null);
+                }
+
+                @Override
+                public void setObject(final String object) {
+                    PropertyResolverConverter prc = new 
PropertyResolverConverter(
+                            SyncopeWebApplication.get().getConverterLocator(),
+                            SyncopeConsoleSession.get().getLocale());
+                    PropertyResolver.setValue(fieldName, bean, object == null 
? null : URI.create(object), prc);
+                }
+            });
+            panel.getField().add(new UrlValidator(new String[] { "http", 
"https" }));
         } else {
             // treat as String if nothing matched above
             panel = new AjaxTextFieldPanel(id, fieldName, model);

Reply via email to