mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
credential store API docs — add example of get
This commit is contained in:
@@ -36,4 +36,8 @@ API allows you to get credentials only by service name.
|
||||
See `CredentialStore`. API has two methods:
|
||||
|
||||
* `get`: Pass service name and user name. Or only service name — in this case first matched entry will be returned.
|
||||
* `set`: Pass credentials attributes and credentials.
|
||||
* `set`: Pass credentials attributes and credentials.
|
||||
|
||||
```kotlin
|
||||
PasswordSafe.instance.get(CredentialAttributes(generateServiceName("Subsystem", "sub key"), username))
|
||||
```
|
||||
@@ -7,6 +7,9 @@ import org.jetbrains.annotations.Contract
|
||||
|
||||
const val SERVICE_NAME_PREFIX = "IntelliJ Platform"
|
||||
|
||||
/**
|
||||
* [See documentation](https://github.com/JetBrains/intellij-community/blob/master/platform/credential-store/readme.md#service-name)
|
||||
*/
|
||||
fun generateServiceName(subsystem: String, key: String) = "$SERVICE_NAME_PREFIX $subsystem — $key"
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user