Class AuthClientHelper
java.lang.Object
com.developer.nefarious.zjoule.plugin.auth.AuthClientHelper
- All Implemented Interfaces:
IAuthClientHelper
A helper class for the
AuthClient
that provides utility methods for
constructing HTTP requests, parsing responses, and managing URI conversions.-
Constructor Summary
ConstructorDescriptionConstructs a newAuthClientHelper
instance and initializes aGson
instance. -
Method Summary
Modifier and TypeMethodDescriptionconvertEndpointStringToURI
(String tokenEndpoint) Converts a token endpoint URL string into aURI
object.convertResponseToObject
(String responseBody) Converts a JSON response body into anAccessToken
object.createRequestBody
(String clientId, String clientSecret) Creates a request body for a client credentials grant type.
-
Constructor Details
-
AuthClientHelper
public AuthClientHelper()Constructs a newAuthClientHelper
instance and initializes aGson
instance.
-
-
Method Details
-
convertEndpointStringToURI
Converts a token endpoint URL string into aURI
object.- Specified by:
convertEndpointStringToURI
in interfaceIAuthClientHelper
- Parameters:
tokenEndpoint
- the token endpoint URL as aString
.- Returns:
- the corresponding
URI
object.
-
convertResponseToObject
Converts a JSON response body into anAccessToken
object.- Specified by:
convertResponseToObject
in interfaceIAuthClientHelper
- Parameters:
responseBody
- the JSON response body as aString
.- Returns:
- an
AccessToken
object created from the response body.
-
createRequestBody
Creates a request body for a client credentials grant type. The request body includes the client ID and client secret encoded as URL parameters.- Specified by:
createRequestBody
in interfaceIAuthClientHelper
- Parameters:
clientId
- the client ID as aString
.clientSecret
- the client secret as aString
.- Returns:
- a
HttpRequest.BodyPublisher
containing the request body.
-