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

[PR] [SYNCOPE-1784] Allow OIDC custom scopes for OIDC client applications [syncope]

SamuelGaro opened a new pull request, #535:
URL: https://github.com/apache/syncope/pull/535

   (no comment)


-- 
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


Re: [PR] [SYNCOPE-1784] Allow custom scopes for OIDC client applications [syncope]

Posted by "ilgrosso (via GitHub)" <gi...@apache.org>.
ilgrosso commented on code in PR #535:
URL: https://github.com/apache/syncope/pull/535#discussion_r1371715153


##########
wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/OIDCRPClientAppTOMapper.java:
##########
@@ -135,24 +131,24 @@ public RegisteredService map(
                     map(p -> p.getAllowedAttributes().stream().collect(Collectors.toSet())).
                     ifPresent(customClaims::addAll);
         }
-        if (rp.getScopes().contains(OIDCScope.profile)) {
+        if (rp.getScopes().contains(OIDCScopeConstants.PROFILE)) {
             customClaims.removeAll(OidcProfileScopeAttributeReleasePolicy.ALLOWED_CLAIMS);
         }
-        if (rp.getScopes().contains(OIDCScope.address)) {
+        if (rp.getScopes().contains(OIDCScopeConstants.ADDRESS)) {
             customClaims.removeAll(OidcAddressScopeAttributeReleasePolicy.ALLOWED_CLAIMS);
         }
-        if (rp.getScopes().contains(OIDCScope.email)) {
+        if (rp.getScopes().contains(OIDCScopeConstants.EMAIL)) {
             customClaims.removeAll(OidcEmailScopeAttributeReleasePolicy.ALLOWED_CLAIMS);
         }
-        if (rp.getScopes().contains(OIDCScope.phone)) {
+        if (rp.getScopes().contains(OIDCScopeConstants.PHONE)) {
             customClaims.removeAll(OidcPhoneScopeAttributeReleasePolicy.ALLOWED_CLAIMS);
         }
 
-        if (!customClaims.isEmpty()) {
-            service.getScopes().add(CUSTOM_SCOPE);
+        if (rp.getScopes().contains(OIDCScopeConstants.CUSTOM_SCOPE)) {

Review Comment:
   This condition should actually remain unchanged, e.g.
   
   ```
   if (!customClaims.isEmpty()) {
   ```



-- 
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


Re: [PR] [SYNCOPE-1784] Allow custom scopes for OIDC client applications [syncope]

Posted by "SamuelGaro (via GitHub)" <gi...@apache.org>.
SamuelGaro merged PR #535:
URL: https://github.com/apache/syncope/pull/535


-- 
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


Re: [PR] [SYNCOPE-1784] Allow OIDC custom scopes for OIDC client applications [syncope]

Posted by "ilgrosso (via GitHub)" <gi...@apache.org>.
ilgrosso commented on code in PR #535:
URL: https://github.com/apache/syncope/pull/535#discussion_r1371692654


##########
common/am/lib/src/main/java/org/apache/syncope/common/lib/OIDCScopeConstants.java:
##########
@@ -16,13 +16,28 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.syncope.common.lib.types;
+package org.apache.syncope.common.lib;
 
-public enum OIDCScope {
-    openid,
-    profile,
-    email,
-    address,
-    phone
+import java.util.Arrays;
+import java.util.List;
 
+public final class OIDCScopeConstants {
+
+    public static final String OPEN_ID = "openid";
+
+    public static final String PROFILE = "profile";
+
+    public static final String EMAIL = "email";
+
+    public static final String ADDRESS = "address";
+
+    public static final String PHONE = "phone";
+
+    public static final String CUSTOM_SCOPE = "syncope";
+
+    public static final List<String> ALL_STANDARD_SCOPES = Arrays.asList(OPEN_ID, PROFILE, EMAIL, ADDRESS, PHONE);

Review Comment:
   Use `List.of()`



##########
common/am/lib/src/main/java/org/apache/syncope/common/lib/OIDCScopeConstants.java:
##########
@@ -16,13 +16,28 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.syncope.common.lib.types;
+package org.apache.syncope.common.lib;
 
-public enum OIDCScope {
-    openid,
-    profile,
-    email,
-    address,
-    phone
+import java.util.Arrays;
+import java.util.List;
 
+public final class OIDCScopeConstants {
+
+    public static final String OPEN_ID = "openid";
+
+    public static final String PROFILE = "profile";
+
+    public static final String EMAIL = "email";
+
+    public static final String ADDRESS = "address";
+
+    public static final String PHONE = "phone";
+
+    public static final String CUSTOM_SCOPE = "syncope";

Review Comment:
   Just name this `SYNCOPE`



-- 
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


Re: [PR] [SYNCOPE-1784] Allow custom scopes for OIDC client applications [syncope]

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #535:
URL: https://github.com/apache/syncope/pull/535#discussion_r1371713111


##########
common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCRPClientAppTO.java:
##########
@@ -135,7 +134,7 @@
 
     @JacksonXmlElementWrapper(localName = "scopes")
     @JacksonXmlProperty(localName = "scope")
-    public List<OIDCScope> getScopes() {
+    public List<String> getScopes() {

Review Comment:
   ## Exposing internal representation
   
   getScopes exposes the internal representation stored in field scopes. The value may be modified [after this call to getScopes](1).
   getScopes exposes the internal representation stored in field scopes. The value may be modified [after this call to getScopes](2).
   getScopes exposes the internal representation stored in field scopes. The value may be modified [after this call to getScopes](3).
   getScopes exposes the internal representation stored in field scopes. The value may be modified [after this call to getScopes](4).
   getScopes exposes the internal representation stored in field scopes. The value may be modified [after this call to getScopes](5).
   getScopes exposes the internal representation stored in field scopes. The value may be modified [after this call to getScopes](6).
   getScopes exposes the internal representation stored in field scopes. The value may be modified [after this call to getScopes](7).
   
   [Show more details](https://github.com/apache/syncope/security/code-scanning/1382)



-- 
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