public static class SdaPlatformBundle.InitialBuilder<C extends io.dropwizard.Configuration> extends java.lang.Object implements InitialPlatformBundleBuilder, CustomConfigurationProviders.AuthConfigProviderBuilder<C>, CustomConfigurationProviders.CorsConfigProviderBuilder<C>, OpenApiCustomizer.OpenApiInitialBuilder<C>, OpenApiCustomizer.OpenApiFinalBuilder<C>, PlatformBundleBuilder<C>
Modifier and Type | Method and Description |
---|---|
OpenApiCustomizer.OpenApiFinalBuilder<C> |
addOpenApiResourcePackage(java.lang.String resourcePackage)
Adds a package to the packages Swagger should scan to pick up resources.
|
OpenApiCustomizer.OpenApiFinalBuilder<C> |
addOpenApiResourcePackageClass(java.lang.Class<?> swaggerResourcePackage)
Adds the package of the given class to the packages Swagger should scan to pick up resources.
|
PlatformBundleBuilder<C> |
alwaysWriteZonedDateTimeWithMillisInJson()
Registers a default serializer for
ZonedDateTime that renders 3 digits of milliseconds. |
PlatformBundleBuilder<C> |
alwaysWriteZonedDateTimeWithoutMillisInJson()
Registers a default serializer for
ZonedDateTime that renders no milliseconds. |
SdaPlatformBundle<C> |
build()
Builds the configured
SdaPlatformBundle which must be added to the Bootstrap in
Application.initialize(Bootstrap) . |
PlatformBundleBuilder<C> |
disableBufferLimitValidationSecurityFeature()
Switches from suppressing the application start to a warn logging for violated buffer limits.
|
<T extends io.dropwizard.Configuration> |
usingCustomConfig(java.lang.Class<T> configurationClass)
Start an application that uses a custom configuration has to define providers for the
configurations required by the
SdaPlatformBundle . |
OpenApiCustomizer.OpenApiInitialBuilder<SdaPlatformConfiguration> |
usingSdaPlatformConfiguration()
Start an application that uses the
SdaPlatformConfiguration as base of it's
configuration file. |
<T extends SdaPlatformConfiguration> |
usingSdaPlatformConfiguration(java.lang.Class<T> configurationClass)
Start an application that uses a customized configuration which extends the
SdaPlatformConfiguration as base of it's configuration file. |
CustomConfigurationProviders.CorsConfigProviderBuilder<C> |
withAuthConfigProvider(org.sdase.commons.server.auth.config.AuthConfigProvider<C> authConfigProvider)
Enables authentication (i.e.
|
PlatformBundleBuilder<C> |
withCorsAdditionalAllowedHeaders(java.lang.String... additionalAllowedHeaders)
Defines additional HTTP headers that clients may send to the application.
|
PlatformBundleBuilder<C> |
withCorsAdditionalExposedHeaders(java.lang.String... additionalExposedHeaders)
Defines additional HTTP headers that can be exposed to clients.
|
PlatformBundleBuilder<C> |
withCorsAllowedMethods(java.lang.String... httpMethods)
Defines the HTTP methods that are used in the application and should be allowed for cross
origin clients.
|
OpenApiCustomizer.OpenApiInitialBuilder<C> |
withCorsConfigProvider(org.sdase.commons.server.cors.CorsConfigProvider<C> corsConfigProvider) |
OpenApiCustomizer.OpenApiFinalBuilder<C> |
withExistingOpenAPI(java.lang.String openApiJsonOrYaml)
Use an existing OpenAPI 3 specification as base for the generation.
|
OpenApiCustomizer.OpenApiFinalBuilder<C> |
withExistingOpenAPIFromClasspathResource(java.lang.String path)
Reads an existing OpenAPI 3 specification from the given classpath resource and provide it to
OpenApiCustomizer.OpenApiInitialBuilder.withExistingOpenAPI(String) |
PlatformBundleBuilder<C> |
withObjectMapperCustomization(java.util.function.Consumer<com.fasterxml.jackson.databind.ObjectMapper> customizer)
Allows customization of the used
ObjectMapper . |
CustomConfigurationProviders.CorsConfigProviderBuilder<C> |
withOpaAuthorization(org.sdase.commons.server.auth.config.AuthConfigProvider<C> authConfigProvider,
org.sdase.commons.server.opa.config.OpaConfigProvider<C> opaConfigProvider)
Enables authentication (i.e.
|
CustomConfigurationProviders.CorsConfigProviderBuilder<C> |
withoutAuthentication()
Disable authentication entirely.
|
OpenApiCustomizer.OpenApiInitialBuilder<C> |
withoutCorsSupport()
Disable CORS support.
|
PlatformBundleBuilder<C> |
withoutFieldFilter()
Disables the field filter entirely.
|
PlatformBundleBuilder<C> |
withoutHalSupport()
Skips registration of the HAL module.
|
public SdaPlatformBundle<C> build()
PlatformBundleBuilder
SdaPlatformBundle
which must be added to the Bootstrap
in
Application.initialize(Bootstrap)
.build
in interface PlatformBundleBuilder<C extends io.dropwizard.Configuration>
SdaPlatformBundle
public OpenApiCustomizer.OpenApiInitialBuilder<SdaPlatformConfiguration> usingSdaPlatformConfiguration()
InitialPlatformBundleBuilder
SdaPlatformConfiguration
as base of it's
configuration file.usingSdaPlatformConfiguration
in interface InitialPlatformBundleBuilder
public <T extends SdaPlatformConfiguration> OpenApiCustomizer.OpenApiInitialBuilder<T> usingSdaPlatformConfiguration(java.lang.Class<T> configurationClass)
InitialPlatformBundleBuilder
SdaPlatformConfiguration
as base of it's configuration file.
The method automatically enables OPA authorization and sets therefore the authorization
configuration via CustomConfigurationProviders.AuthConfigProviderBuilder.withOpaAuthorization(AuthConfigProvider,
OpaConfigProvider)
and the cors configuration via CustomConfigurationProviders.CorsConfigProviderBuilder.withCorsConfigProvider(CorsConfigProvider)
usingSdaPlatformConfiguration
in interface InitialPlatformBundleBuilder
configurationClass
- - the customized configuration of the applicationpublic <T extends io.dropwizard.Configuration> CustomConfigurationProviders.AuthConfigProviderBuilder<T> usingCustomConfig(java.lang.Class<T> configurationClass)
InitialPlatformBundleBuilder
SdaPlatformBundle
.usingCustomConfig
in interface InitialPlatformBundleBuilder
T
- the type of the applications configuration classconfigurationClass
- the class that stores the configurationpublic CustomConfigurationProviders.CorsConfigProviderBuilder<C> withoutAuthentication()
CustomConfigurationProviders.AuthConfigProviderBuilder
withoutAuthentication
in interface CustomConfigurationProviders.AuthConfigProviderBuilder<C extends io.dropwizard.Configuration>
public CustomConfigurationProviders.CorsConfigProviderBuilder<C> withAuthConfigProvider(org.sdase.commons.server.auth.config.AuthConfigProvider<C> authConfigProvider)
CustomConfigurationProviders.AuthConfigProviderBuilder
withAuthConfigProvider
in interface CustomConfigurationProviders.AuthConfigProviderBuilder<C extends io.dropwizard.Configuration>
authConfigProvider
- a provider, for the AuthConfig
, e.g. MyAppConfig::getAuth
public CustomConfigurationProviders.CorsConfigProviderBuilder<C> withOpaAuthorization(org.sdase.commons.server.auth.config.AuthConfigProvider<C> authConfigProvider, org.sdase.commons.server.opa.config.OpaConfigProvider<C> opaConfigProvider)
CustomConfigurationProviders.AuthConfigProviderBuilder
OpaBundle
to authorize the requests. Requests without
Authorization header will not be rejected but need to be handled in the Authorization
policy.withOpaAuthorization
in interface CustomConfigurationProviders.AuthConfigProviderBuilder<C extends io.dropwizard.Configuration>
authConfigProvider
- a provider, for the AuthConfig
, e.g. MyAppConfig::getAuth
opaConfigProvider
- a provider, for the OpaConfig
, e.g. MyAppConfig::getOpa
public OpenApiCustomizer.OpenApiInitialBuilder<C> withoutCorsSupport()
CustomConfigurationProviders.CorsConfigProviderBuilder
withoutCorsSupport
in interface CustomConfigurationProviders.CorsConfigProviderBuilder<C extends io.dropwizard.Configuration>
public OpenApiCustomizer.OpenApiInitialBuilder<C> withCorsConfigProvider(org.sdase.commons.server.cors.CorsConfigProvider<C> corsConfigProvider)
withCorsConfigProvider
in interface CustomConfigurationProviders.CorsConfigProviderBuilder<C extends io.dropwizard.Configuration>
corsConfigProvider
- a provider, for the CorsConfiguration
, e.g. MyAppConfig::getCors
public PlatformBundleBuilder<C> disableBufferLimitValidationSecurityFeature()
SecurityCustomizer
disableBufferLimitValidationSecurityFeature
in interface SecurityCustomizer<C extends io.dropwizard.Configuration>
public PlatformBundleBuilder<C> withCorsAllowedMethods(java.lang.String... httpMethods)
CorsCustomizer
httpMethods
overwrite the default methods
.
"PATCH"
withCorsAllowedMethods
in interface CorsCustomizer<C extends io.dropwizard.Configuration>
httpMethods
- all HTTP methods that will be allowed by the CORS filter.public PlatformBundleBuilder<C> withCorsAdditionalAllowedHeaders(java.lang.String... additionalAllowedHeaders)
CorsCustomizer
CorsBundle.FinalBuilder#ALWAYS_ALLOWED_HEADERS
are always allowed to be send and
must not be added here.withCorsAdditionalAllowedHeaders
in interface CorsCustomizer<C extends io.dropwizard.Configuration>
additionalAllowedHeaders
- additional HTTP headers that clients may send to the
application.public PlatformBundleBuilder<C> withCorsAdditionalExposedHeaders(java.lang.String... additionalExposedHeaders)
CorsCustomizer
CorsBundle.FinalBuilder#ALWAYS_EXPOSED_HEADERS
can always be exposed and must not be added
here.withCorsAdditionalExposedHeaders
in interface CorsCustomizer<C extends io.dropwizard.Configuration>
additionalExposedHeaders
- additional HTTP headers that can be exposed.public PlatformBundleBuilder<C> withoutHalSupport()
JacksonCustomizer
withoutHalSupport
in interface JacksonCustomizer<C extends io.dropwizard.Configuration>
public PlatformBundleBuilder<C> withoutFieldFilter()
JacksonCustomizer
EnableFieldFilter
for each resource.withoutFieldFilter
in interface JacksonCustomizer<C extends io.dropwizard.Configuration>
public PlatformBundleBuilder<C> withObjectMapperCustomization(java.util.function.Consumer<com.fasterxml.jackson.databind.ObjectMapper> customizer)
JacksonCustomizer
ObjectMapper
. More customizers may be added by calling
this method multiple times.withObjectMapperCustomization
in interface JacksonCustomizer<C extends io.dropwizard.Configuration>
customizer
- receives the used ObjectMapper
for customization, e.g. to enable or
disable specific features or configure formatting.public PlatformBundleBuilder<C> alwaysWriteZonedDateTimeWithMillisInJson()
JacksonCustomizer
ZonedDateTime
that renders 3 digits of milliseconds.
The same serializer may be configured per field as documented in Iso8601Serializer.WithMillis
.
This setting overwrites the default behaviour of Jackson which omits milliseconds if they are zero or adds nanoseconds if they are set.
alwaysWriteZonedDateTimeWithMillisInJson
in interface JacksonCustomizer<C extends io.dropwizard.Configuration>
public PlatformBundleBuilder<C> alwaysWriteZonedDateTimeWithoutMillisInJson()
JacksonCustomizer
ZonedDateTime
that renders no milliseconds. The same
serializer may be configured per field as documented in Iso8601Serializer
.
This setting overwrites the default behaviour of Jackson which omits milliseconds if they are zero or adds nanoseconds if they are set.
alwaysWriteZonedDateTimeWithoutMillisInJson
in interface JacksonCustomizer<C extends io.dropwizard.Configuration>
public OpenApiCustomizer.OpenApiFinalBuilder<C> withExistingOpenAPI(java.lang.String openApiJsonOrYaml)
OpenApiCustomizer.OpenApiInitialBuilder
Note that the OpenAPI annotations always override values from the files if classes are
registered with OpenApiCustomizer.OpenApiInitialBuilder.addOpenApiResourcePackage(String)
or OpenApiCustomizer.OpenApiInitialBuilder.addOpenApiResourcePackageClass(Class)
.
withExistingOpenAPI
in interface OpenApiCustomizer.OpenApiInitialBuilder<C extends io.dropwizard.Configuration>
openApiJsonOrYaml
- the OpenAPI 3 specification as json or yamlOpenApiBundle.InitialBuilder.withExistingOpenAPI(String)
public OpenApiCustomizer.OpenApiFinalBuilder<C> withExistingOpenAPIFromClasspathResource(java.lang.String path)
OpenApiCustomizer.OpenApiInitialBuilder
OpenApiCustomizer.OpenApiInitialBuilder.withExistingOpenAPI(String)
withExistingOpenAPIFromClasspathResource
in interface OpenApiCustomizer.OpenApiInitialBuilder<C extends io.dropwizard.Configuration>
path
- the path to an OpenAPI 3 YAML or JSON file in the classpath.OpenApiBundle.InitialBuilder.withExistingOpenAPIFromClasspathResource(String)
public OpenApiCustomizer.OpenApiFinalBuilder<C> addOpenApiResourcePackage(java.lang.String resourcePackage)
OpenApiCustomizer.OpenApiInitialBuilder
addOpenApiResourcePackage
in interface OpenApiCustomizer.OpenApiInitialBuilder<C extends io.dropwizard.Configuration>
resourcePackage
- the package to be scanned; not nullOpenApiBundle.InitialBuilder.addResourcePackage(String)
public OpenApiCustomizer.OpenApiFinalBuilder<C> addOpenApiResourcePackageClass(java.lang.Class<?> swaggerResourcePackage)
OpenApiCustomizer.OpenApiInitialBuilder
addOpenApiResourcePackageClass
in interface OpenApiCustomizer.OpenApiInitialBuilder<C extends io.dropwizard.Configuration>
swaggerResourcePackage
- the class whose package should be scanned; not nullOpenApiBundle.InitialBuilder.addResourcePackageClass(Class)