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 2025/05/08 14:10:38 UTC
[PR] [SYNCOPE-1877] Removing SAML2SPEntity and related [syncope]
ilgrosso opened a new pull request, #1072:
URL: https://github.com/apache/syncope/pull/1072
(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-1877] Removing SAML2SPEntity and related [syncope]
Posted by "ilgrosso (via GitHub)" <gi...@apache.org>.
ilgrosso merged PR #1072:
URL: https://github.com/apache/syncope/pull/1072
--
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-1877] Removing SAML2SPEntity and related [syncope]
Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #1072:
URL: https://github.com/apache/syncope/pull/1072#discussion_r2079830429
##########
client/am/console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPEntityWizardBuilder.java:
##########
@@ -100,14 +103,35 @@
return wizardModel;
}
- protected class TextPem extends Pem {
+ protected class Metadata extends WizardStep {
Review Comment:
## Inner class could be static
Metadata should be made static, since the enclosing instance is not used.
[Show more details](https://github.com/apache/syncope/security/code-scanning/2245)
##########
client/am/console/src/main/java/org/apache/syncope/client/console/wizards/SAML2IdPEntityWizardBuilder.java:
##########
@@ -100,14 +103,35 @@
return wizardModel;
}
- protected class TextPem extends Pem {
+ protected class Metadata extends WizardStep {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = -3043839139187792810L;
+
+ Metadata(final SAML2IdPEntityTO entity, final PageReference pageRef) {
+ add(new XMLEditorPanel(null, new PropertyModel<>(entity, "metadata"), false, pageRef));
+ }
+
+ @Override
+ public String getTitle() {
+ return "Metadata";
+ }
+ }
+
+ protected class TextPem extends WizardStep {
Review Comment:
## Inner class could be static
TextPem should be made static, since the enclosing instance is not used.
[Show more details](https://github.com/apache/syncope/security/code-scanning/2246)
##########
wa/starter/src/main/java/org/apache/syncope/wa/starter/pac4j/saml/WASAML2ClientMetadataGenerator.java:
##########
@@ -55,24 +56,20 @@
@Override
public MetadataResolver buildMetadataResolver() throws Exception {
- String encodedMetadata = Base64.getEncoder().encodeToString(
+ String metadata = Base64.getEncoder().encodeToString(
getMetadata(buildEntityDescriptor()).getBytes(StandardCharsets.UTF_8));
- SAML2SPEntityTO entityTO;
try {
- entityTO = waRestClient.getService(SAML2SPEntityService.class).get(saml2Client.getName());
- entityTO.setMetadata(encodedMetadata);
- } catch (Exception e) {
- LOG.debug("SP Entity {} not found, creating new", saml2Client.getName(), e);
+ AuthModuleTO authModule = waRestClient.getService(AuthModuleService.class).
+ readByClientName(saml2Client.getName());
- entityTO = new SAML2SPEntityTO.Builder().
- key(saml2Client.getName()).
- metadata(encodedMetadata).
- build();
- }
+ ((SAML2IdPAuthModuleConf) authModule.getConf()).setServiceProviderMetadata(metadata);
- LOG.debug("Storing SP Entity {}", entityTO);
- waRestClient.getService(SAML2SPEntityService.class).set(entityTO);
+ LOG.debug("Storing SP AuthModule {}", authModule);
Review Comment:
## Use of default toString()
Default toString(): AuthModuleTO inherits toString() from Object, and so is not suitable for printing.
[Show more details](https://github.com/apache/syncope/security/code-scanning/2244)
##########
wa/starter/src/main/java/org/apache/syncope/wa/starter/pac4j/saml/WASAML2ClientKeystoreGenerator.java:
##########
@@ -71,27 +79,20 @@
LOG.debug("Encoded keystore {}", encodedKeystore);
}
- SAML2SPEntityTO entityTO;
- try {
- entityTO = waRestClient.getService(SAML2SPEntityService.class).get(saml2Client.getName());
- entityTO.setKeystore(encodedKeystore);
- } catch (Exception e) {
- LOG.debug("SP Entity {} keystore not found, creating new", saml2Client.getName(), e);
-
- entityTO = new SAML2SPEntityTO.Builder().key(saml2Client.getName()).keystore(encodedKeystore).build();
- }
+ AuthModuleTO authModule = authModule();
+ ((SAML2IdPAuthModuleConf) authModule.getConf()).setKeystore(encodedKeystore);
- LOG.debug("Storing SP Entity {}", entityTO);
- waRestClient.getService(SAML2SPEntityService.class).set(entityTO);
+ LOG.debug("Storing SP AuthModule {}", authModule);
Review Comment:
## Use of default toString()
Default toString(): AuthModuleTO inherits toString() from Object, and so is not suitable for printing.
[Show more details](https://github.com/apache/syncope/security/code-scanning/2243)
--
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-1877] Removing SAML2SPEntity and related [syncope]
Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #1072:
URL: https://github.com/apache/syncope/pull/1072#discussion_r2081111104
##########
common/am/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/wa/WASAML2SPService.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.rest.api.service.wa;
+
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.security.SecurityRequirements;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.constraints.NotNull;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.core.Response;
+import java.io.InputStream;
+import org.apache.syncope.common.rest.api.service.JAXRSService;
+
+/**
+ * REST operations for WA to work with SAML2SP clients.
+ */
+@Tag(name = "WA")
+@SecurityRequirements({
+ @SecurityRequirement(name = "BasicAuthentication"),
+ @SecurityRequirement(name = "Bearer") })
+@Path("wa/saml2sp")
+public interface WASAML2SPService extends JAXRSService {
Review Comment:
## Constant interface anti-pattern
Type WASAML2SPService implements constant interface [JAXRSService](1).
[Show more details](https://github.com/apache/syncope/security/code-scanning/2247)
--
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