Package dev.reuss.tmdb.core.auth
Record Class TmdbAuth
java.lang.Object
java.lang.Record
dev.reuss.tmdb.core.auth.TmdbAuth
- Record Components:
accessToken- TMDB bearer access token
- All Implemented Interfaces:
Serializable
Represents TMDB API authentication.
TMDB API requests are authenticated with a bearer access token.
This value object stores the raw access token and can create the
corresponding HTTP Authorization header value.
The access token is intentionally masked in toString() to
avoid accidentally exposing credentials in logs or debug output.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theaccessTokenrecord component.Returns the value for the HTTPAuthorizationheader.static TmdbAuthbearerToken(String accessToken) Creates authentication from a TMDB bearer access token.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.toString()Returns a masked string representation to avoid leaking the access token.
-
Constructor Details
-
TmdbAuth
Creates a new TMDB authentication value.- Parameters:
accessToken- the TMDB bearer access token- Throws:
IllegalArgumentException- if the access token isnull, blank or empty
-
-
Method Details
-
bearerToken
Creates authentication from a TMDB bearer access token.- Parameters:
accessToken- the TMDB bearer access token- Returns:
- a new TMDB authentication value
- Throws:
IllegalArgumentException- if the access token isnull, blank or empty
-
authorizationHeaderValue
Returns the value for the HTTPAuthorizationheader.- Returns:
- the authorization header value in the format
Bearer <token>
-
toString
Returns a masked string representation to avoid leaking the access token. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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). -
accessToken
Returns the value of theaccessTokenrecord component.- Returns:
- the value of the
accessTokenrecord component
-