Record Class ClientCredentialsTokenResponse
java.lang.Object
java.lang.Record
io.leandev.appfuse.security.auth.ClientCredentialsTokenResponse
- Record Components:
access_token- 短效存取 tokentoken_type- 固定Bearerexpires_in- 有效秒數
public record ClientCredentialsTokenResponse(String access_token, String token_type, long expires_in)
extends Record
client_credentials 的成功回應(RFC 6749 §4.4.3)
不含 refresh token——§4.4.3 明文 SHOULD NOT;M2M 客戶端隨時可用自己的憑證再換一個。
元件名刻意採 snake_case,直接對應 RFC 的線上欄位名(access_token / token_type /
expires_in),序列化不需額外標註。回應體在兩種方言下相同——JSON 本就是 RFC 規定的
回應格式,方言差異只在請求與錯誤(見 OAuth2TokenException)。
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionClientCredentialsTokenResponse(String access_token, String token_type, long expires_in) Creates an instance of aClientCredentialsTokenResponserecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theaccess_tokenrecord component.以 Bearer 類型建立回應final booleanIndicates whether some other object is "equal to" this one.longReturns the value of theexpires_inrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thetoken_typerecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
TOKEN_TYPE_BEARER
-
-
Constructor Details
-
ClientCredentialsTokenResponse
Creates an instance of aClientCredentialsTokenResponserecord class.- Parameters:
access_token- the value for theaccess_tokenrecord componenttoken_type- the value for thetoken_typerecord componentexpires_in- the value for theexpires_inrecord component
-
-
Method Details
-
bearer
以 Bearer 類型建立回應- Parameters:
accessToken- 存取 tokenexpiresInSeconds- 有效秒數
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
access_token
Returns the value of theaccess_tokenrecord component.- Returns:
- the value of the
access_tokenrecord component
-
token_type
Returns the value of thetoken_typerecord component.- Returns:
- the value of the
token_typerecord component
-
expires_in
public long expires_in()Returns the value of theexpires_inrecord component.- Returns:
- the value of the
expires_inrecord component
-