public static final class HttpSignProvider.Builder extends Object implements Builder<HttpSignProvider>
build() to create a provider instance.| Modifier and Type | Method and Description |
|---|---|
HttpSignProvider.Builder |
addAcceptHeader(HttpSignHeader header)
Add a header that is validated on inbound requests.
|
HttpSignProvider.Builder |
addInbound(InboundClientDefinition client)
Add inbound configuration.
|
HttpSignProvider |
build()
Build the instance from this builder.
|
HttpSignProvider.Builder |
config(Config config)
Create a builder from configuration.
|
HttpSignProvider.Builder |
inboundRequiredHeaders(SignedHeadersConfig inboundRequiredHeaders)
Override the default inbound required headers (e.g.
|
HttpSignProvider.Builder |
optional(boolean optional)
Set whether the signature is optional.
|
HttpSignProvider.Builder |
outbound(OutboundConfig targets)
Add outbound targets to this builder.
|
HttpSignProvider.Builder |
realm(String realm)
Realm to use for challenging inbound requests that do not have "Authorization" header
in case header is
HttpSignHeader.AUTHORIZATION and singatures are not optional. |
public HttpSignProvider build()
Builderbuild in interface Builder<HttpSignProvider>public HttpSignProvider.Builder config(Config config)
config - Config located at http-signatures keypublic HttpSignProvider.Builder outbound(OutboundConfig targets)
OutboundTargetDefinition attached through
OutboundTarget.Builder#customObject(Class, Object) to tell us how to sign
the request.
The same can be done through configuration:
{
name = "http-signatures"
class = "HttpSignProvider"
http-signatures {
targets: [
{
name = "service2"
hosts = ["localhost"]
paths = ["/service2/.*"]
# This configures the OutboundTargetDefinition
signature {
key-id = "service1"
hmac.secret = "${CLEAR=password}"
}
}]
}
}
targets - targets to select correct outbound securitypublic HttpSignProvider.Builder addInbound(InboundClientDefinition client)
The same can be done through configuration:
{
name = "http-signatures"
class = "HttpSignProvider"
http-signatures {
inbound {
# This configures the InboundClientDefinition
keys: [
{
key-id = "service1"
hmac.secret = "${CLEAR=password}"
}]
}
}
}
client - a single client configuration for inbound communicationpublic HttpSignProvider.Builder inboundRequiredHeaders(SignedHeadersConfig inboundRequiredHeaders)
Defaults:
HttpSignHeader.AUTHORIZATION ourselvesinboundRequiredHeaders - headers configurationpublic HttpSignProvider.Builder addAcceptHeader(HttpSignHeader header)
header - header to look for signaturepublic HttpSignProvider.Builder optional(boolean optional)
SecurityResponse.SecurityStatus#ABSTAIN from this request if signature is not
present. If set to false, this provider will fail
if signature is not present.optional - true for optional singaturespublic HttpSignProvider.Builder realm(String realm)
HttpSignHeader.AUTHORIZATION and singatures are not optional.realm - realm to challenge with, defautls to "prime"Copyright © 2018–2019 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms.