This repository was archived by the owner on Apr 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
This repository was archived by the owner on Apr 10, 2024. It is now read-only.
Keyring cannot find item when run in parallel #9
Copy link
Copy link
Closed
Labels
Description
The keyring accessor is able to successfully load the secret when running alone, but fail with error when running with multiple threads:
** Message: Remote error from secret service: org.freedesktop.DBus.Error.UnknownMethod: No such interface 'org.freedesktop.Secret.Item' on object at path /org/freedesktop/secrets/collection/Default_5fkeyring/10Exception in thread "main" com.azure.core.exception.ClientAuthenticationException: Cannot get accounts from token cache. Error: Structure.getFieldOrder() on class com.microsoft.aad.msal4jextensions.persistence.linux.GError returns names ([code, domain, message]) which do not match declared field names ([])
The error is thrown when publicClientApplication.getAccounts() is called. Stack trace:
Caused by: com.microsoft.aad.msal4jextensions.persistence.linux.KeyRingAccessException: An error while validating KeyRing availability
at com.microsoft.aad.msal4jextensions.persistence.linux.KeyRingAccessor.verify(KeyRingAccessor.java:61)
at com.microsoft.aad.msal4jextensions.PersistenceTokenCacheAccessAspect.<init>(PersistenceTokenCacheAccessAspect.java:84)
at com.azure.identity.implementation.IdentityClient.getPublicClientApplication(IdentityClient.java:158)
at com.azure.identity.implementation.IdentityClient.lambda$authenticateWithSharedTokenCache$23(IdentityClient.java:525)
The persistence settings is defined as follow:
PersistenceSettings getPersistenceSettings() {
return PersistenceSettings.builder(cacheFileName, cacheFileDirectory)
.setLinuxKeyring("default, "org.freedesktop.Secret.Generic", "MSALCache",
"MsalClientID", "Microsoft.Developer.IdentityService", null, null)
.build();
}