-
-
Notifications
You must be signed in to change notification settings - Fork 174
Closed
Description
Is your feature request related to a problem? Please describe.
Hi All,
We noticed a performance issue about access_token and user_info api in openid connect scenario, we are using openam 14.5.3.
In this case we noticed, by jprofile istrumentations, a performance issue in AMKeyProvider.getKeyPair(alias) in greater detail in getPrivateKey() method.
I suggest you to use a ConcurrentHashMap about caching the private key after the first recovery from keystore.
You can see the jprofile details in attachment.
Describe the solution you'd like
I suggest you to change the code like this below.
private static Map<String, PrivateKey> mapKey = new ConcurrentHashMap<>();
public KeyPair getKeyPair(String certAlias) {
PublicKey publicKey = getPublicKey(certAlias);
PrivateKey privateKey=null;
if (mapKey.containsKey(certAlias))
{
privateKey=mapKey.get(certAlias);
}
else
{
privateKey = getPrivateKey(certAlias);
mapKey.putIfAbsent(certAlias, privateKey);
}
if (publicKey != null && privateKey != null) {
return new KeyPair(publicKey, privateKey);
} else {
return null;
}
}
Describe alternatives you've considered
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
