ilgrosso commented on a change in pull request #223:
URL: https://github.com/apache/syncope/pull/223#discussion_r512759540
##########
File path:
core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ClientAppDataBinderImpl.java
##########
@@ -226,96 +172,59 @@ private void doUpdate(final OIDCRP clientApp, final
OIDCRPTO clientAppTO) {
clientApp.getSupportedGrantTypes().addAll(clientAppTO.getSupportedGrantTypes());
clientApp.getSupportedResponseTypes().addAll(clientAppTO.getSupportedResponseTypes());
- if (clientAppTO.getAuthPolicy() == null) {
- clientApp.setAuthPolicy(null);
- } else {
- Policy policy = policyDAO.find(clientAppTO.getAuthPolicy());
- if (policy instanceof AuthPolicy) {
- clientApp.setAuthPolicy((AuthPolicy) policy);
- } else {
- SyncopeClientException sce =
SyncopeClientException.build(ClientExceptionType.InvalidPolicy);
- if (policy == null) {
- sce.getElements().add("Policy " +
clientAppTO.getAuthPolicy() + " not found");
- } else {
- sce.getElements().add("Expected " +
AuthPolicy.class.getSimpleName()
- + ", found " + policy.getClass().getSimpleName());
- }
- throw sce;
- }
- }
-
- if (clientAppTO.getAccessPolicy() == null) {
- clientApp.setAccessPolicy(null);
- } else {
- Policy policy = policyDAO.find(clientAppTO.getAccessPolicy());
- if (policy instanceof AccessPolicy) {
- clientApp.setAccessPolicy((AccessPolicy) policy);
- } else {
- SyncopeClientException sce =
SyncopeClientException.build(ClientExceptionType.InvalidPolicy);
- if (policy == null) {
- sce.getElements().add("Policy " +
clientAppTO.getAccessPolicy() + " not found");
- } else {
- sce.getElements().add("Expected " +
AccessPolicy.class.getSimpleName()
- + ", found " + policy.getClass().getSimpleName());
- }
- throw sce;
- }
- }
-
- if (clientAppTO.getAttrReleasePolicy() == null) {
- clientApp.setAttrReleasePolicy(null);
- } else {
- Policy policy = policyDAO.find(clientAppTO.getAttrReleasePolicy());
- if (policy instanceof AttrReleasePolicy) {
- clientApp.setAttrReleasePolicy((AttrReleasePolicy) policy);
- } else {
- SyncopeClientException sce =
SyncopeClientException.build(ClientExceptionType.InvalidPolicy);
- if (policy == null) {
- sce.getElements().add("Policy " +
clientAppTO.getAttrReleasePolicy() + " not found");
- } else {
- sce.getElements().add("Expected " +
AttrReleasePolicy.class.getSimpleName()
- + ", found " + policy.getClass().getSimpleName());
- }
- throw sce;
- }
- }
-
clientApp.setLogoutUri(clientAppTO.getLogoutUri());
}
private static OIDCRPTO getClientAppTO(final OIDCRP clientApp) {
OIDCRPTO clientAppTO = new OIDCRPTO();
+ updateCommonClientAppTO(clientApp, clientAppTO);
- clientAppTO.setName(clientApp.getName());
- clientAppTO.setKey(clientApp.getKey());
- clientAppTO.setDescription(clientApp.getDescription());
- clientAppTO.setClientAppId(clientApp.getClientAppId());
clientAppTO.setClientId(clientApp.getClientId());
clientAppTO.setClientSecret(clientApp.getClientSecret());
clientAppTO.setSignIdToken(clientApp.isSignIdToken());
clientAppTO.setSubjectType(clientApp.getSubjectType());
clientAppTO.getRedirectUris().addAll(clientApp.getRedirectUris());
clientAppTO.getSupportedGrantTypes().addAll(clientApp.getSupportedGrantTypes());
clientAppTO.getSupportedResponseTypes().addAll(clientApp.getSupportedResponseTypes());
-
- clientAppTO.setAuthPolicy(clientApp.getAuthPolicy() == null
- ? null : clientApp.getAuthPolicy().getKey());
- clientAppTO.setAccessPolicy(clientApp.getAccessPolicy() == null
- ? null : clientApp.getAccessPolicy().getKey());
- clientAppTO.setAttrReleasePolicy(clientApp.getAttrReleasePolicy() ==
null
- ? null : clientApp.getAttrReleasePolicy().getKey());
-
clientAppTO.setLogoutUri(clientApp.getLogoutUri());
return clientAppTO;
}
private void doUpdate(final CASSP clientApp, final CASSPTO clientAppTO) {
+ doUpdateCommon(clientApp, clientAppTO);
+
+ clientApp.setServiceId(clientAppTO.getServiceId());
+ }
+
+ private static CASSPTO getClientAppTO(final CASSP clientApp) {
Review comment:
I mean this:
https://github.com/apache/syncope/pull/223/checks?check_run_id=1314109065
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]