public final class Credentials extends Object
Values are held as char[] so they can be wiped with clear().
Well-known keys (USERNAME, PASSWORD, ACCESS_KEY, SECRET_KEY,
SESSION_TOKEN, TOKEN) let backends agree on names without a rigid type hierarchy;
backends may also define their own keys.
toString() prints key names only — never secret values.
CredentialsResolver| Modifier and Type | Class and Description |
|---|---|
static class |
Credentials.Builder |
| Modifier and Type | Field and Description |
|---|---|
static String |
ACCESS_KEY |
static String |
PASSWORD |
static String |
SECRET_KEY |
static String |
SESSION_TOKEN |
static String |
TOKEN |
static String |
USERNAME |
| Modifier and Type | Method and Description |
|---|---|
static Credentials.Builder |
builder() |
void |
clear()
Overwrites all secret values with zeros and empties this bundle.
|
boolean |
contains(String key) |
Credentials |
copy()
Returns an independent copy of these credentials.
|
String |
get(String key)
Returns the value for the given key or
null if it's absent (or this instance was cleared). |
long |
getExpiresOn()
Returns the time in milliseconds when these credentials expire or zero (0) if no expiry is known.
|
Set<String> |
getKeys() |
boolean |
isExpired() |
boolean |
isExpired(long skewMilliseconds)
Indicates if these credentials have expired or will expire within the next
skewMilliseconds. |
static Credentials |
of(String... keyValuePairs)
Creates credentials from alternating key-value pairs:
Credentials.of(Credentials.USERNAME, "scott", Credentials.PASSWORD, "tiger"). |
String |
require(String key)
Returns the value for the given key or throws a
DataException if it's absent. |
String |
toString() |
public static final String USERNAME
public static final String PASSWORD
public static final String ACCESS_KEY
public static final String SECRET_KEY
public static final String SESSION_TOKEN
public static final String TOKEN
public static Credentials.Builder builder()
public static Credentials of(String... keyValuePairs)
Credentials.of(Credentials.USERNAME, "scott", Credentials.PASSWORD, "tiger").public String get(String key)
null if it's absent (or this instance was cleared).public String require(String key) throws DataException
DataException if it's absent.DataExceptionpublic boolean contains(String key)
public long getExpiresOn()
public boolean isExpired(long skewMilliseconds)
skewMilliseconds. Always returns false when no expiry is known.public boolean isExpired()
public Credentials copy()
public void clear()
get(String) return null.Copyright (c) 2006-2026 North Concepts Inc. All Rights Reserved.