Record Class BearerToken
java.lang.Object
java.lang.Record
com.eqixiac.equinix.core.auth.BearerToken
- Record Components:
value- the bearer token; must not benullor blankexpiresAt- when the token expires, ornullwhen unknown
A bearer access token supplied by a
BearerTokenProvider: the token value sent as
Authorization: Bearer <value> and, optionally, the instant it expires.
When expiresAt is known, the SDK asks the provider for a new token shortly (30
seconds) before that instant. When it is null, the token is used until the service
answers HTTP 401, at which point the provider is asked once for a replacement.
- Author:
- ianjones
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theexpiresAtrecord component.final inthashCode()Returns a hash code value for this object.static BearerTokenA token with no known expiry.toString()Never prints the token value, so a token cannot leak into logs throughtoString().value()Returns the value of thevaluerecord component.
-
Constructor Details
-
BearerToken
Validates the token value.- Throws:
NullPointerException- ifvalueisnullIllegalArgumentException- ifvalueis blank
-
-
Method Details
-
of
A token with no known expiry.- Parameters:
value- the bearer token- Returns:
- the token
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
value
-
expiresAt
-