Skip to content
This repository was archived by the owner on Apr 10, 2024. It is now read-only.
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

@jianghaolu

Description

@jianghaolu

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions