Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the initialization process inside synchronized blocks @SAMLSSOUtil #263

Open
deshankoswatte opened this issue Nov 15, 2019 · 0 comments

Comments

@deshankoswatte
Copy link
Member

deshankoswatte commented Nov 15, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant