Skip to content

Improve the initialization process inside synchronized blocks @SAMLSSOUtil #263

@deshankoswatte

Description

@deshankoswatte

Description:

Current the variables:

  • ssoSigner
  • ssoEncrypter
  • samlAssertionBuilder
  • samlHTTPRedirectSignatureValidator

in SAMLSSOUtil are initialized in a synchronized block inside each method which they are used as below:

try {
synchronized (Runtime.getRuntime().getClass()) {
ssoSigner = (SSOSigner) Class.forName(IdentityUtil.getProperty(
SAMLSSOConstants.SAMLSSO_SIGNER_CLASS_NAME).trim()).newInstance();
ssoSigner.init();
}
return ssoSigner.setSignature(request, signatureAlgorithm, digestAlgorithm, cred);

A suggested improvement to the process would be to initialize them in one place like the doBootstrap() method:

public static void doBootstrap() {
if (!isBootStrapped) {
try {
DefaultBootstrap.bootstrap();
isBootStrapped = true;
} catch (ConfigurationException e) {
log.error("Error in bootstrapping the OpenSAML2 library", e);
}
}
}

Suggested Labels:
Improvement

Suggested Assignees:
N/A

Related Issues:
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions