Interface Authenticator
-
- All Known Implementing Classes:
BasicAuthenticator,BearerTokenAuthenticator,DummyHttpAuthenticator
public interface AuthenticatorDefines the interface of an HTTP authenticator.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.StringgetAuthorizationHeaderValue(com.smartgridready.ns.v0.DeviceFrame deviceDescription, com.smartgridready.driver.api.http.GenHttpClientFactory httpClientFactory)Retrieves the value of the authorization header of HTTP requests.default booleanisTokenRenewalSupported()Tells if access tokens can be renewed instead of re-authenticating.default voidrenewToken(com.smartgridready.ns.v0.DeviceFrame deviceDescription, com.smartgridready.driver.api.http.GenHttpClientFactory httpClientFactory)Renews the access token.
-
-
-
Method Detail
-
getAuthorizationHeaderValue
java.lang.String getAuthorizationHeaderValue(com.smartgridready.ns.v0.DeviceFrame deviceDescription, com.smartgridready.driver.api.http.GenHttpClientFactory httpClientFactory) throws java.io.IOException, RestApiServiceCallException, RestApiResponseParseExceptionRetrieves the value of the authorization header of HTTP requests.- Parameters:
deviceDescription- the SGr device specificationhttpClientFactory- the SGr HTTP client factory- Returns:
- a string
- Throws:
java.io.IOException- when a communication error occurredRestApiServiceCallException- when the authentication failedRestApiResponseParseException- when the response could not be parsed
-
isTokenRenewalSupported
default boolean isTokenRenewalSupported()
Tells if access tokens can be renewed instead of re-authenticating. Defaults tofalse.- Returns:
- a boolean
-
renewToken
default void renewToken(com.smartgridready.ns.v0.DeviceFrame deviceDescription, com.smartgridready.driver.api.http.GenHttpClientFactory httpClientFactory) throws java.io.IOException, RestApiServiceCallException, RestApiResponseParseExceptionRenews the access token. Defaults to an empty implementation.- Parameters:
deviceDescription- the SGr device specificationhttpClientFactory- the SGr HTTP client factory- Throws:
java.io.IOException- when a communication error occurredRestApiServiceCallException- when the renewal failedRestApiResponseParseException- when the response could not be parsed
-
-