Class OutboundTargetDefinition.Builder
- java.lang.Object
-
- io.helidon.security.providers.httpsign.OutboundTargetDefinition.Builder
-
- All Implemented Interfaces:
Builder<OutboundTargetDefinition>
,Supplier<OutboundTargetDefinition>
- Enclosing class:
- OutboundTargetDefinition
public static final class OutboundTargetDefinition.Builder extends Object implements Builder<OutboundTargetDefinition>
Fluent API builder to buildOutboundTargetDefinition
instances. Callbuild()
to create a new instance.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OutboundTargetDefinition.Builder
algorithm(String algorithm)
Algorithm used by this signature.OutboundTargetDefinition.Builder
backwardCompatibleEol(Boolean backwardCompatible)
Until version 3.0.0 (exclusive) there is a trailing end of line added to the signed data.OutboundTargetDefinition
build()
Build the instance from this builder.OutboundTargetDefinition.Builder
config(Config config)
Update this builder instance from configuration.OutboundTargetDefinition.Builder
header(HttpSignHeader header)
Header to store signature in.OutboundTargetDefinition.Builder
hmacSecret(byte[] secret)
Shared secret for HMAC based algorithms.OutboundTargetDefinition.Builder
hmacSecret(String secret)
Shared secret for HMAC based algorithms.OutboundTargetDefinition.Builder
keyId(String keyId)
Key id of this service (will be mapped by target service to validate signature).OutboundTargetDefinition.Builder
privateKeyConfig(KeyConfig keyConfig)
Private key configuration for RSA based algorithms.OutboundTargetDefinition.Builder
signedHeaders(SignedHeadersConfig config)
Configuration of required and "if-present" headers to be signed for this target.OutboundTargetDefinition.Builder
tokenHandler(TokenHandler tokenHandler)
Configure a token handler to create the outbound header.
-
-
-
Method Detail
-
keyId
public OutboundTargetDefinition.Builder keyId(String keyId)
Key id of this service (will be mapped by target service to validate signature).- Parameters:
keyId
- key id mapped by target service- Returns:
- updated builder instance
-
header
public OutboundTargetDefinition.Builder header(HttpSignHeader header)
Header to store signature in.- Parameters:
header
- header type- Returns:
- updated builder instance
-
algorithm
public OutboundTargetDefinition.Builder algorithm(String algorithm)
Algorithm used by this signature. Set automatically on call to methodsprivateKeyConfig(KeyConfig)
andhmacSecret(byte[])
.- Parameters:
algorithm
- algorithm to use for outbound signatures- Returns:
- updated builder instance
-
privateKeyConfig
public OutboundTargetDefinition.Builder privateKeyConfig(KeyConfig keyConfig)
Private key configuration for RSA based algorithms. If called sets the algorithm to "rsa-sha256". Expects either explicit private key, or keystore and private key alias.- Parameters:
keyConfig
- private key configuration for outbound signatures- Returns:
- updated builder instance
-
signedHeaders
public OutboundTargetDefinition.Builder signedHeaders(SignedHeadersConfig config)
Configuration of required and "if-present" headers to be signed for this target. Defaults to the same asHttpSignProvider.Builder.inboundRequiredHeaders(SignedHeadersConfig)
.- Parameters:
config
- configuration of outbound headers to be signed for each method.- Returns:
- updated builder instance
-
hmacSecret
public OutboundTargetDefinition.Builder hmacSecret(byte[] secret)
Shared secret for HMAC based algorithms. Also sets the algorithm to "hmac-sha256"- Parameters:
secret
- secret to sign outgoing requests (symmetric)- Returns:
- updated builder instance
-
hmacSecret
public OutboundTargetDefinition.Builder hmacSecret(String secret)
Shared secret for HMAC based algorithms. CallshmacSecret(byte[])
getting bytes of the secret string with UTF-8.- Parameters:
secret
- shared secret to sign outgoing requests- Returns:
- updated builder instance
-
tokenHandler
public OutboundTargetDefinition.Builder tokenHandler(TokenHandler tokenHandler)
Configure a token handler to create the outbound header.- Parameters:
tokenHandler
- token handler to use- Returns:
- updated builder instance
-
build
public OutboundTargetDefinition build()
Description copied from interface:Builder
Build the instance from this builder.- Specified by:
build
in interfaceBuilder<OutboundTargetDefinition>
- Returns:
- instance of the built type
-
config
public OutboundTargetDefinition.Builder config(Config config)
Update this builder instance from configuration.- Parameters:
config
- config instance- Returns:
- updated builder instance
-
backwardCompatibleEol
public OutboundTargetDefinition.Builder backwardCompatibleEol(Boolean backwardCompatible)
Until version 3.0.0 (exclusive) there is a trailing end of line added to the signed data. When configured tofalse
, the correct approach is used.- Parameters:
backwardCompatible
- whether to run in backward compatible mode- Returns:
- updated builder instance
-
-