Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

StoredCredential with empty string username causes exception #10

Description

@rsteimen

The following code throws a NullPointerException if an empty string ("") is used for username. The code works fine if a non-empty string is used. Tested on Windows 10 using OpenJDK 15 only.

Expected behavior would be eighter:
a) Don't accept "" in StoredCredential constructor
b) (preferred) Don't throw an exception during store.get() to enable storing passwords/secrets without a username.

com.microsoft.credentialstorage.SecretStore<StoredCredential> store = StorageProvider.getCredentialStorage(true, StorageProvider.SecureOption.REQUIRED);
String username = "";
store.add("dummy", new StoredCredential(username, "xxx".toCharArray()));
try {
    store.get("dummy");
} catch (Exception e) {
    e.printStackTrace();
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions