Record Class DeviceAuthorization
java.lang.Object
java.lang.Record
com.irurueta.authserver.serviceclient.device.DeviceAuthorization
- Record Components:
deviceCode- the code the CLI presents when polling; a secret, never printed.userCode- the code the user types (or confirms) on the verification page.verificationUri- the page where the user approves the request.verificationUriComplete- the same page with the user code included; may benull(optional in the RFC).expiresIn- seconds the device code lives; the default when the server sends none or sendsnull.interval- minimum seconds between two polls; the default when the server sends none or sendsnull(Spring Authorization Server does not send one).
public record DeviceAuthorization(String deviceCode, String userCode, String verificationUri, String verificationUriComplete, long expiresIn, long interval)
extends Record
Response of the device authorization endpoint (RFC 8628 section 3.2).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longLifetime assumed when the server does not say (the Spring Authorization Server default is five minutes).static final longPolling interval assumed when the server does not say (RFC 8628 section 3.2).private final StringThe field for thedeviceCoderecord component.private final longThe field for theexpiresInrecord component.private final longThe field for theintervalrecord component.private final StringThe field for theuserCoderecord component.private final StringThe field for theverificationUrirecord component.private final StringThe field for theverificationUriCompleterecord component. -
Constructor Summary
ConstructorsConstructorDescriptionDeviceAuthorization(String deviceCode, String userCode, String verificationUri, String verificationUriComplete, long expiresIn, long interval) Validates the mandatory members and applies the defaults of the optional ones. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedeviceCoderecord component.final booleanIndicates whether some other object is "equal to" this one.longReturns the value of theexpiresInrecord component.final inthashCode()Returns a hash code value for this object.longinterval()Returns the value of theintervalrecord component.private static booleanTells whether a text is missing or blank.toString()Describes the authorization without the device code, which is a secret.userCode()Returns the value of theuserCoderecord component.Returns the value of theverificationUrirecord component.Returns the value of theverificationUriCompleterecord component.
-
Field Details
-
deviceCode
The field for thedeviceCoderecord component. -
userCode
The field for theuserCoderecord component. -
verificationUri
The field for theverificationUrirecord component. -
verificationUriComplete
The field for theverificationUriCompleterecord component. -
expiresIn
private final long expiresInThe field for theexpiresInrecord component. -
interval
private final long intervalThe field for theintervalrecord component. -
DEFAULT_EXPIRES_IN_SECONDS
public static final long DEFAULT_EXPIRES_IN_SECONDSLifetime assumed when the server does not say (the Spring Authorization Server default is five minutes).- See Also:
-
DEFAULT_INTERVAL_SECONDS
public static final long DEFAULT_INTERVAL_SECONDSPolling interval assumed when the server does not say (RFC 8628 section 3.2).- See Also:
-
-
Constructor Details
-
DeviceAuthorization
public DeviceAuthorization(String deviceCode, String userCode, String verificationUri, String verificationUriComplete, long expiresIn, long interval) Validates the mandatory members and applies the defaults of the optional ones.- Parameters:
deviceCode- the device code.userCode- the user code.verificationUri- the verification page.verificationUriComplete- the verification page with the user code; optional.expiresIn- seconds the device code lives; zero or negative means the default.interval- seconds between polls; zero or negative means the default.
-
-
Method Details
-
toString
Describes the authorization without the device code, which is a secret. -
isBlank
Tells whether a text is missing or blank.- Parameters:
value- the text.- Returns:
truewhen it has no content.
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
deviceCode
Returns the value of thedeviceCoderecord component.- Returns:
- the value of the
deviceCoderecord component
-
userCode
Returns the value of theuserCoderecord component.- Returns:
- the value of the
userCoderecord component
-
verificationUri
Returns the value of theverificationUrirecord component.- Returns:
- the value of the
verificationUrirecord component
-
verificationUriComplete
Returns the value of theverificationUriCompleterecord component.- Returns:
- the value of the
verificationUriCompleterecord component
-
expiresIn
public long expiresIn()Returns the value of theexpiresInrecord component.- Returns:
- the value of the
expiresInrecord component
-
interval
public long interval()Returns the value of theintervalrecord component.- Returns:
- the value of the
intervalrecord component
-