This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 3_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/3_0_X by this push: new 5b49310771 WA: add support for OIDCRP's generateRefreshToken 5b49310771 is described below commit 5b493107710f67d30574bae5dad2aa9ee054acb7 Author: Francesco Chicchiriccò <ilgro...@apache.org> AuthorDate: Mon Nov 20 15:33:31 2023 +0100 WA: add support for OIDCRP's generateRefreshToken --- .../clientapps/ClientAppModalPanelBuilder.java | 2 ++ .../clientapps/ClientAppDirectoryPanel.properties | 1 + .../ClientAppDirectoryPanel_fr_CA.properties | 1 + .../ClientAppDirectoryPanel_it.properties | 1 + .../ClientAppDirectoryPanel_ja.properties | 1 + .../ClientAppDirectoryPanel_pt_BR.properties | 1 + .../ClientAppDirectoryPanel_ru.properties | 1 + .../syncope/common/lib/to/OIDCRPClientAppTO.java | 24 ++++++++++++++++------ .../persistence/api/entity/am/OIDCRPClientApp.java | 4 ++++ .../jpa/entity/am/JPAOIDCRPClientApp.java | 12 +++++++++++ .../java/data/ClientAppDataBinderImpl.java | 2 ++ .../starter/mapping/OIDCRPClientAppTOMapper.java | 1 + 12 files changed, 45 insertions(+), 6 deletions(-) diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java index 6d0d09bd35..94432309ad 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java @@ -301,6 +301,8 @@ public class ClientAppModalPanelBuilder<T extends ClientAppTO> extends AbstractM "field", "jwtAccessToken", new PropertyModel<>(clientAppTO, "jwtAccessToken"))); fields.add(new AjaxCheckBoxPanel( "field", "bypassApprovalPrompt", new PropertyModel<>(clientAppTO, "bypassApprovalPrompt"))); + fields.add(new AjaxCheckBoxPanel( + "field", "generateRefreshToken", new PropertyModel<>(clientAppTO, "generateRefreshToken"))); AjaxDropDownChoicePanel<OIDCSubjectType> subjectType = new AjaxDropDownChoicePanel<>( "field", "subjectType", new PropertyModel<>(clientAppTO, "subjectType"), false); diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel.properties index 49116e51d8..734fe671ab 100644 --- a/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel.properties +++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel.properties @@ -70,3 +70,4 @@ logoutType=Logout Type jwks=JWKS jwksUri=JWKS URI tokenEndpointAuthenticationMethod=Token Endpoint Authentication Method +generateRefreshToken=Generate Refresh Token diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_fr_CA.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_fr_CA.properties index 13b5ea6270..e1cded71e7 100644 --- a/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_fr_CA.properties +++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_fr_CA.properties @@ -70,3 +70,4 @@ logoutType=Logout Type jwks=JWKS jwksUri=JWKS URI tokenEndpointAuthenticationMethod=Token Endpoint Authentication Method +generateRefreshToken=Generate Refresh Token diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_it.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_it.properties index 8b3cebc799..a9cb0277f8 100644 --- a/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_it.properties +++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_it.properties @@ -70,3 +70,4 @@ logoutType=Tipo Logout jwks=JWKS jwksUri=JWKS URI tokenEndpointAuthenticationMethod=Metodo di autenticazione dell'endpoint token +generateRefreshToken=Genera Refresh Token diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_ja.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_ja.properties index aa63ddba37..207cc7f18f 100644 --- a/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_ja.properties +++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_ja.properties @@ -70,3 +70,4 @@ logoutType=Logout Type jwks=JWKS jwksUri=JWKS URI tokenEndpointAuthenticationMethod=Token Endpoint Authentication Method +generateRefreshToken=Generate Refresh Token diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_pt_BR.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_pt_BR.properties index aa4455ca36..65ddf146bb 100644 --- a/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_pt_BR.properties +++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_pt_BR.properties @@ -70,3 +70,4 @@ logoutType=Logout Type jwks=JWKS jwksUri=JWKS URI tokenEndpointAuthenticationMethod=Token Endpoint Authentication Method +generateRefreshToken=Generate Refresh Token diff --git a/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_ru.properties b/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_ru.properties index 5d93238893..b49b8abc9f 100644 --- a/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_ru.properties +++ b/client/am/console/src/main/resources/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel_ru.properties @@ -71,3 +71,4 @@ logoutType=Logout Type jwks=JWKS jwksUri=JWKS URI tokenEndpointAuthenticationMethod=Token Endpoint Authentication Method +generateRefreshToken=Generate Refresh Token diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCRPClientAppTO.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCRPClientAppTO.java index 88ebf1e2d0..04ab489a33 100644 --- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCRPClientAppTO.java +++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/OIDCRPClientAppTO.java @@ -44,6 +44,10 @@ public class OIDCRPClientAppTO extends ClientAppTO { private boolean jwtAccessToken; + private boolean bypassApprovalPrompt = true; + + private boolean generateRefreshToken = true; + private OIDCSubjectType subjectType; private final List<String> redirectUris = new ArrayList<>(); @@ -54,8 +58,6 @@ public class OIDCRPClientAppTO extends ClientAppTO { private final List<String> scopes = new ArrayList<>(); - private boolean bypassApprovalPrompt = true; - private String jwks; private String jwksUri; @@ -146,6 +148,14 @@ public class OIDCRPClientAppTO extends ClientAppTO { this.bypassApprovalPrompt = bypassApprovalPrompt; } + public boolean isGenerateRefreshToken() { + return generateRefreshToken; + } + + public void setGenerateRefreshToken(final boolean generateRefreshToken) { + this.generateRefreshToken = generateRefreshToken; + } + public String getJwks() { return jwks; } @@ -196,13 +206,14 @@ public class OIDCRPClientAppTO extends ClientAppTO { .append(this.clientId, rhs.clientId) .append(this.clientSecret, rhs.clientSecret) .append(this.signIdToken, rhs.signIdToken) + .append(this.jwtAccessToken, rhs.jwtAccessToken) + .append(this.bypassApprovalPrompt, rhs.bypassApprovalPrompt) + .append(this.generateRefreshToken, rhs.generateRefreshToken) .append(this.subjectType, rhs.subjectType) .append(this.redirectUris, rhs.redirectUris) .append(this.supportedGrantTypes, rhs.supportedGrantTypes) .append(this.supportedResponseTypes, rhs.supportedResponseTypes) - .append(this.jwtAccessToken, rhs.jwtAccessToken) .append(this.scopes, rhs.scopes) - .append(this.bypassApprovalPrompt, rhs.bypassApprovalPrompt) .append(this.jwks, rhs.jwks) .append(this.jwksUri, rhs.jwksUri) .append(this.tokenEndpointAuthenticationMethod, rhs.tokenEndpointAuthenticationMethod) @@ -217,13 +228,14 @@ public class OIDCRPClientAppTO extends ClientAppTO { .append(clientId) .append(clientSecret) .append(signIdToken) + .append(jwtAccessToken) + .append(bypassApprovalPrompt) + .append(generateRefreshToken) .append(subjectType) .append(redirectUris) .append(supportedGrantTypes) .append(supportedResponseTypes) - .append(jwtAccessToken) .append(scopes) - .append(bypassApprovalPrompt) .append(jwks) .append(jwksUri) .append(tokenEndpointAuthenticationMethod) diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/am/OIDCRPClientApp.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/am/OIDCRPClientApp.java index 504bfd6d34..ddcfc8ce02 100644 --- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/am/OIDCRPClientApp.java +++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/am/OIDCRPClientApp.java @@ -54,6 +54,10 @@ public interface OIDCRPClientApp extends ClientApp { void setBypassApprovalPrompt(boolean bypassApprovalPrompt); + boolean isGenerateRefreshToken(); + + void setGenerateRefreshToken(boolean generateRefreshToken); + OIDCSubjectType getSubjectType(); void setSubjectType(OIDCSubjectType subjectType); diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/am/JPAOIDCRPClientApp.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/am/JPAOIDCRPClientApp.java index 8d4c43f9c0..75c1771bc3 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/am/JPAOIDCRPClientApp.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/am/JPAOIDCRPClientApp.java @@ -74,6 +74,8 @@ public class JPAOIDCRPClientApp extends AbstractClientApp implements OIDCRPClien private boolean bypassApprovalPrompt = true; + private boolean generateRefreshToken = true; + @Enumerated(EnumType.STRING) private OIDCSubjectType subjectType; @@ -166,6 +168,16 @@ public class JPAOIDCRPClientApp extends AbstractClientApp implements OIDCRPClien this.bypassApprovalPrompt = bypassApprovalPrompt; } + @Override + public boolean isGenerateRefreshToken() { + return generateRefreshToken; + } + + @Override + public void setGenerateRefreshToken(final boolean generateRefreshToken) { + this.generateRefreshToken = generateRefreshToken; + } + @Override public OIDCSubjectType getSubjectType() { return subjectType; diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ClientAppDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ClientAppDataBinderImpl.java index 7bebba11b6..b3ead637ce 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ClientAppDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ClientAppDataBinderImpl.java @@ -227,6 +227,7 @@ public class ClientAppDataBinderImpl implements ClientAppDataBinder { clientApp.setSignIdToken(clientAppTO.isSignIdToken()); clientApp.setJwtAccessToken(clientAppTO.isJwtAccessToken()); clientApp.setBypassApprovalPrompt(clientAppTO.isBypassApprovalPrompt()); + clientApp.setGenerateRefreshToken(clientAppTO.isGenerateRefreshToken()); clientApp.setSubjectType(clientAppTO.getSubjectType()); clientApp.getRedirectUris().clear(); clientApp.getRedirectUris().addAll(clientAppTO.getRedirectUris()); @@ -257,6 +258,7 @@ public class ClientAppDataBinderImpl implements ClientAppDataBinder { clientAppTO.setLogoutUri(clientApp.getLogoutUri()); clientAppTO.setJwtAccessToken(clientApp.isJwtAccessToken()); clientAppTO.setBypassApprovalPrompt(clientApp.isBypassApprovalPrompt()); + clientAppTO.setGenerateRefreshToken(clientApp.isGenerateRefreshToken()); clientAppTO.setJwks(clientApp.getJwks()); clientAppTO.setJwksUri(clientApp.getJwksUri()); clientAppTO.setTokenEndpointAuthenticationMethod(clientApp.getTokenEndpointAuthenticationMethod()); diff --git a/wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/OIDCRPClientAppTOMapper.java b/wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/OIDCRPClientAppTOMapper.java index d9eb49fc7c..894e46e923 100644 --- a/wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/OIDCRPClientAppTOMapper.java +++ b/wa/starter/src/main/java/org/apache/syncope/wa/starter/mapping/OIDCRPClientAppTOMapper.java @@ -84,6 +84,7 @@ public class OIDCRPClientAppTOMapper extends AbstractClientAppMapper { } service.setJwtAccessToken(rp.isJwtAccessToken()); service.setBypassApprovalPrompt(rp.isBypassApprovalPrompt()); + service.setGenerateRefreshToken(rp.isGenerateRefreshToken()); if (StringUtils.isNotBlank(rp.getJwksUri())) { service.setJwks(rp.getJwksUri()); } else {