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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]