IntelliJ Platform Plugin SDK Help

Persisting Sensitive Data

The Credentials Store API allows you to store sensitive user data securely, like passwords, server URLs, etc.

How to Use

Use PasswordSafe to work with credentials.

Common Utility Method:

private CredentialAttributes createCredentialAttributes(String key) { return new CredentialAttributes( CredentialAttributesKt.generateServiceName("MySystem", key) ); }

Retrieve Stored Credentials

String key = null; // e.g. serverURL, accountID CredentialAttributes attributes = createCredentialAttributes(key); PasswordSafe passwordSafe = PasswordSafe.getInstance(); Credentials credentials = passwordSafe.get(attributes); if (credentials != null) { String password = credentials.getPasswordAsString(); } // or get password only String password = passwordSafe.getPassword(attributes);

Store Credentials

CredentialAttributes attributes = createCredentialAttributes(key); Credentials credentials = new Credentials(username, password); PasswordSafe.getInstance().set(attributes, credentials);

To remove stored credentials, pass null for the credentials parameter.


The default storage format depends on the OS.




File in KeePass format


Keychain using Security Framework


Secret Service API using libsecret

Users can override the default behavior in Settings | Appearance & Behavior | System Settings | Passwords.

Last modified: 18 October 2023