Class ClientId


  • public class ClientId
    extends java.lang.Object
    An OAuth2 user authorization Client ID and associated information.

    Corresponds to the information in the json file downloadable for a Client ID.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ClientId.Builder  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ClientId​(java.lang.String clientId, java.lang.String clientSecret)
      Constructs a client ID using an explicit ID and secret
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ClientId fromJson​(java.util.Map<java.lang.String,​java.lang.Object> json)
      Constructs a Client ID from JSON from a downloaded file.
      static ClientId fromResource​(java.lang.Class<?> relativeClass, java.lang.String resourceName)
      Constructs a Client ID from JSON file stored as a resource.
      static ClientId fromStream​(java.io.InputStream stream)
      Constructs a Client ID from JSON file stream.
      java.lang.String getClientId()
      Returns the text identifier of the Client ID.
      java.lang.String getClientSecret()
      Returns the secret associated with the Client ID.
      static ClientId.Builder newBuilder()  
      static ClientId of​(java.lang.String clientId, java.lang.String clientSecret)
      Constructs a client ID from an explicit ID and secret.
      ClientId.Builder toBuilder()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • FIELD_TYPE_INSTALLED

        private static final java.lang.String FIELD_TYPE_INSTALLED
        See Also:
        Constant Field Values
      • FIELD_CLIENT_SECRET

        private static final java.lang.String FIELD_CLIENT_SECRET
        See Also:
        Constant Field Values
      • JSON_PARSE_ERROR

        private static final java.lang.String JSON_PARSE_ERROR
        See Also:
        Constant Field Values
      • clientId

        private final java.lang.String clientId
      • clientSecret

        private final java.lang.String clientSecret
    • Constructor Detail

      • ClientId

        private ClientId​(java.lang.String clientId,
                         java.lang.String clientSecret)
        Constructs a client ID using an explicit ID and secret

        Note: Direct use of this constructor in application code is not recommended to avoid having secrets or values that need to be updated in source code.

        Parameters:
        clientId - Text identifier of the Client ID.
        clientSecret - Secret to associated with the Client ID.
    • Method Detail

      • of

        public static ClientId of​(java.lang.String clientId,
                                  java.lang.String clientSecret)
        Constructs a client ID from an explicit ID and secret.

        Note: Direct use of this factory method in application code is not recommended to avoid having secrets or values that need to be updated in source code.

        Parameters:
        clientId - Text identifier of the Client ID.
        clientSecret - Secret to associated with the Client ID.
        Returns:
        The ClientId instance.
      • fromJson

        public static ClientId fromJson​(java.util.Map<java.lang.String,​java.lang.Object> json)
                                 throws java.io.IOException
        Constructs a Client ID from JSON from a downloaded file.
        Parameters:
        json - the JSON from the downloaded file
        Returns:
        the ClientId instance based on the JSON
        Throws:
        java.io.IOException - the JSON could not be parsed
      • fromResource

        public static ClientId fromResource​(java.lang.Class<?> relativeClass,
                                            java.lang.String resourceName)
                                     throws java.io.IOException
        Constructs a Client ID from JSON file stored as a resource.
        Parameters:
        relativeClass - a class in the same namespace as the resource
        resourceName - the name of the resource
        Returns:
        the constructed ClientID instance based on the JSON in the resource
        Throws:
        java.io.IOException - The JSON could not be loaded or parsed.
      • fromStream

        public static ClientId fromStream​(java.io.InputStream stream)
                                   throws java.io.IOException
        Constructs a Client ID from JSON file stream.
        Parameters:
        stream - the downloaded JSON file
        Returns:
        the constructed ClientID instance based on the JSON in the stream
        Throws:
        java.io.IOException - the JSON could not be read or parsed
      • getClientId

        public final java.lang.String getClientId()
        Returns the text identifier of the Client ID.
        Returns:
        The text identifier of the Client ID.
      • getClientSecret

        public final java.lang.String getClientSecret()
        Returns the secret associated with the Client ID.
        Returns:
        The secret associated with the Client ID.