Package energy.trolie.client.spp
Class SppApiTokenHeaderProvider
java.lang.Object
energy.trolie.client.spp.SppApiTokenHeaderProvider
- All Implemented Interfaces:
RequestHeaderProvider
A
RequestHeaderProvider that implements the SPP Two-Factor Authentication
(TFA) token generation as specified in the SPP TFA Technical Specifications v1.4.
For every outgoing request, this provider generates a fresh X-SPP-API-Token
header containing:
- A UTC timestamp
- A unique nonce (UUID, max 128 characters)
- An HMAC-SHA512 signature over the request metadata
-
Constructor Summary
ConstructorsConstructorDescriptionSppApiTokenHeaderProvider(String screenName, String apiKey, Clock clock) Creates anSppApiTokenHeaderProviderwith the given credentials. -
Method Summary
-
Constructor Details
-
SppApiTokenHeaderProvider
Creates anSppApiTokenHeaderProviderwith the given credentials.- Parameters:
screenName- the SPP-assigned screen name for this clientapiKey- the Base64-encoded API key assigned by SPPclock- the clock to use for timestamp generation (useClock.systemUTC()in production)
-
-
Method Details
-
headersFor
- Specified by:
headersForin interfaceRequestHeaderProvider
-