Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Keyring cannot find item when run in parallel #9

Closed
jianghaolu opened this issue Apr 13, 2020 · 0 comments
Closed

Keyring cannot find item when run in parallel #9

jianghaolu opened this issue Apr 13, 2020 · 0 comments

Comments

@jianghaolu
Copy link

jianghaolu commented Apr 13, 2020

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/10

Exception 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();
    }

And the keyring item is available:
Screenshot from 2020-04-13 20-13-43

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

No branches or pull requests

3 participants