Class Credentials
java.lang.Object
com.northconcepts.datapipeline.security.Credentials
An immutable bundle of resolved secret values keyed by name, with an optional expiry.
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.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAssemblesCredentialsfrom key-value pairs and an optional expiry; seebuilder(). -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Credentials.Builderbuilder()Creates a builder for assembling credentials one key at a time, with an optional expiry.voidclear()Overwrites all secret values with zeros and empties this bundle.booleanReturns true if a value is present for the given key (falsefor every key afterclear()).copy()Returns an independent copy of these credentials.Returns the value for the given key ornullif it's absent (or this instance was cleared).longReturns the time in milliseconds when these credentials expire or zero (0) if no expiry is known.getKeys()Returns a read-only view of the keys present in these credentials.booleanIndicates if these credentials have already expired; always returnsfalsewhen no expiry is known.booleanisExpired(long skewMilliseconds) Indicates if these credentials have expired or will expire within the nextskewMilliseconds.static CredentialsCreates credentials from alternating key-value pairs:Credentials.of(Credentials.USERNAME, "scott", Credentials.PASSWORD, "tiger").Returns the value for the given key or throws aDataExceptionif it's absent.toString()
-
Field Details
-
USERNAME
- See Also:
-
PASSWORD
- See Also:
-
ACCESS_KEY
- See Also:
-
SECRET_KEY
- See Also:
-
SESSION_TOKEN
- See Also:
-
TOKEN
- See Also:
-
-
Method Details
-
builder
Creates a builder for assembling credentials one key at a time, with an optional expiry. -
of
Creates credentials from alternating key-value pairs:Credentials.of(Credentials.USERNAME, "scott", Credentials.PASSWORD, "tiger"). -
get
Returns the value for the given key ornullif it's absent (or this instance was cleared). -
require
Returns the value for the given key or throws aDataExceptionif it's absent.- Throws:
DataException
-
contains
Returns true if a value is present for the given key (falsefor every key afterclear()). -
getKeys
Returns a read-only view of the keys present in these credentials. -
getExpiresOn
public long getExpiresOn()Returns the time in milliseconds when these credentials expire or zero (0) if no expiry is known. -
isExpired
public boolean isExpired(long skewMilliseconds) Indicates if these credentials have expired or will expire within the nextskewMilliseconds. Always returnsfalsewhen no expiry is known. -
isExpired
public boolean isExpired()Indicates if these credentials have already expired; always returnsfalsewhen no expiry is known. -
copy
Returns an independent copy of these credentials. Clearing the copy does not affect this instance. -
clear
public void clear()Overwrites all secret values with zeros and empties this bundle. Subsequent calls toget(String)returnnull. -
toString
-