You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@syncope.apache.org by "ilgrosso (via GitHub)" <gi...@apache.org> on 2023/02/22 12:21:15 UTC

[GitHub] [syncope] ilgrosso commented on a diff in pull request #413: [SYNCOPE-1732] support generic access policy configuration through be…

ilgrosso commented on code in PR #413:
URL: https://github.com/apache/syncope/pull/413#discussion_r1114245710


##########
common/am/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultAccessPolicyConf.java:
##########
@@ -94,14 +92,12 @@ public void setUnauthorizedRedirectUrl(final URI unauthorizedRedirectUrl) {
     }
 
     @JacksonXmlElementWrapper(localName = "requiredAttrs")

Review Comment:
   This annotation should be removed altogether.



##########
wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/DefaultAccessMapper.java:
##########
@@ -43,10 +45,12 @@ public RegisteredServiceAccessStrategy build(final AccessPolicyTO policy) {
         accessStrategy.setUnauthorizedRedirectUrl(conf.getUnauthorizedRedirectUrl());
 
         conf.getRequiredAttrs().forEach(
-                attr -> accessStrategy.getRequiredAttributes().put(attr.getSchema(), new HashSet<>(attr.getValues())));
+                (k, v) -> accessStrategy.getRequiredAttributes().put(k,
+                        new HashSet<>(Set.of(StringUtils.split(v, ",")))));

Review Comment:
   Questions:
   1. are `new Hashet<>(Set.of(...)) both required? wouldn't be enough to have `Set.of(...)`?
   2. can we `trim()` the values after splitting by `,`? I'd like to avoid issues if one inputs `value1, value2` as oppositve as `value1,value2`



##########
common/am/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultAccessPolicyConf.java:
##########
@@ -94,14 +92,12 @@ public void setUnauthorizedRedirectUrl(final URI unauthorizedRedirectUrl) {
     }
 
     @JacksonXmlElementWrapper(localName = "requiredAttrs")
-    @JacksonXmlProperty(localName = "requiredAttr")
-    public List<Attr> getRequiredAttrs() {
+    public Map<String, String> getRequiredAttrs() {
         return requiredAttrs;
     }
 
     @JacksonXmlElementWrapper(localName = "rejectedAttrs")

Review Comment:
   This annotation should be removed altogether.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@syncope.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org