public class OpaInputHeadersExtension extends java.lang.Object implements OpaInputExtension<javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String>>
OpaInput
.
Header names are defined as case-insensitive by the HTTP RFC (RFC 7230 Sec. 3.2). This filter normalizes all headers to lowercase and included as:
…, "headers": { "my-header": ["value0", "value1", "value2"], "another-header": ["value0,value1", "value2,value3"] }
Headers are currently passed to OPA as read by the framework. There might be an issue with multivalued headers. The representation differs depending on how the client sends the headers. It might be a list with values, or one entry separated with a separator, for example ',' or a combination of both.
Modifier and Type | Class and Description |
---|---|
static class |
OpaInputHeadersExtension.Builder |
static interface |
OpaInputHeadersExtension.ExtensionBuilder |
Modifier and Type | Method and Description |
---|---|
static OpaInputHeadersExtension.ExtensionBuilder |
builder() |
javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> |
createAdditionalInputContent(javax.ws.rs.container.ContainerRequestContext requestContext)
When registered, it is called in
OpaAuthFilter.filter(ContainerRequestContext) . |
public static OpaInputHeadersExtension.ExtensionBuilder builder()
public javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> createAdditionalInputContent(javax.ws.rs.container.ContainerRequestContext requestContext)
OpaInputExtension
OpaAuthFilter.filter(ContainerRequestContext)
. The return
value is added as child of the property name defined during the registration
.
Example that adds the property "myExtension": true
:
public class OpaInputHeadersExtension implements OpaInputExtension<Boolean> { @Override public Boolean createAdditionalInputContent(ContainerRequestContext requestContext) { return true; } } // ... in your application OpaBundle.builder() // ... .withInputExtension("myExtension", new MyOpaExtension()) .build(); // ...
createAdditionalInputContent
in interface OpaInputExtension<javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String>>
requestContext
- the request context