Class PortMapperConfigurer<H extends HttpSecurityBuilder<H>>
java.lang.Object
org.springframework.security.config.annotation.SecurityConfigurerAdapter<DefaultSecurityFilterChain,B>
org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer<PortMapperConfigurer<H>,H>
org.springframework.security.config.annotation.web.configurers.PortMapperConfigurer<H>
- All Implemented Interfaces:
SecurityConfigurer<DefaultSecurityFilterChain,
H>
public final class PortMapperConfigurer<H extends HttpSecurityBuilder<H>>
extends AbstractHttpConfigurer<PortMapperConfigurer<H>,H>
Allows configuring a shared
PortMapper
instance used to determine the ports
when redirecting between HTTP and HTTPS. The PortMapper
can be obtained from
AbstractConfiguredSecurityBuilder.getSharedObject(Class)
.- Since:
- 3.2
-
Nested Class Summary
Modifier and TypeClassDescriptionfinal class
Allows specifying the HTTPS port for a given HTTP port when redirecting between HTTP and HTTPS. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionhttp
(int httpPort) Adds a port mappingvoid
Initialize theSecurityBuilder
.portMapper
(PortMapper portMapper) Allows specifying thePortMapper
instance.Methods inherited from class org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer
disable, getSecurityContextHolderStrategy, withObjectPostProcessor
Methods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter
addObjectPostProcessor, and, configure, getBuilder, postProcess, setBuilder
-
Constructor Details
-
PortMapperConfigurer
public PortMapperConfigurer()Creates a new instance
-
-
Method Details
-
portMapper
Allows specifying thePortMapper
instance.- Parameters:
portMapper
-- Returns:
- the
PortMapperConfigurer
for further customizations
-
http
Adds a port mapping- Parameters:
httpPort
- the HTTP port that maps to a specific HTTPS port.- Returns:
PortMapperConfigurer<H extends HttpSecurityBuilder<H>>.HttpPortMapping
to define the HTTPS port
-
init
Description copied from interface:SecurityConfigurer
Initialize theSecurityBuilder
. Here only shared state should be created and modified, but not properties on theSecurityBuilder
used for building the object. This ensures that theSecurityConfigurer.configure(SecurityBuilder)
method uses the correct shared objects when building. Configurers should be applied here.- Specified by:
init
in interfaceSecurityConfigurer<DefaultSecurityFilterChain,
H extends HttpSecurityBuilder<H>> - Overrides:
init
in classSecurityConfigurerAdapter<DefaultSecurityFilterChain,
H extends HttpSecurityBuilder<H>>
-