Record Class DeviceCodeOAuthFlow

java.lang.Object
java.lang.Record
org.a2aproject.sdk.spec.DeviceCodeOAuthFlow
Record Components:
deviceAuthorizationUrl - the device authorization endpoint URL (required)
tokenUrl - URL for the token endpoint where credentials are exchanged for tokens (required)
refreshUrl - URL for obtaining refresh tokens (optional)
scopes - map of available OAuth scopes to their descriptions (required)

public record DeviceCodeOAuthFlow(String deviceAuthorizationUrl, String tokenUrl, String refreshUrl, Map<String,String> scopes) extends Record
Configuration details for the OAuth 2.0 Device Code flow (RFC 8628).

This flow is designed for input-constrained devices such as IoT devices, and CLI tools where the user authenticates on a separate device.

See Also:
  • Constructor Details

    • DeviceCodeOAuthFlow

      public DeviceCodeOAuthFlow(String deviceAuthorizationUrl, String tokenUrl, String refreshUrl, Map<String,String> scopes)
      Compact constructor that validates required fields.
      Parameters:
      deviceAuthorizationUrl - the device authorization endpoint URL (required)
      tokenUrl - URL for the token endpoint where credentials are exchanged for tokens (required)
      refreshUrl - URL for obtaining refresh tokens (optional)
      scopes - map of available OAuth scopes to their descriptions (required)
      Throws:
      IllegalArgumentException - if authorizationUrl, scopes, or tokenUrl is null
  • Method Details

    • scopes

      public Map<String,String> scopes()
      Returns an unmodifiable copy of the scopes map.
      Returns:
      unmodifiable map of available OAuth scopes to their descriptions
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • deviceAuthorizationUrl

      public String deviceAuthorizationUrl()
      Returns the value of the deviceAuthorizationUrl record component.
      Returns:
      the value of the deviceAuthorizationUrl record component
    • tokenUrl

      public String tokenUrl()
      Returns the value of the tokenUrl record component.
      Returns:
      the value of the tokenUrl record component
    • refreshUrl

      public String refreshUrl()
      Returns the value of the refreshUrl record component.
      Returns:
      the value of the refreshUrl record component