org.springframework.security.config.annotation.web.configurers
Class PortMapperConfigurer<H extends HttpSecurityBuilder<H>>

java.lang.Object
  extended by org.springframework.security.config.annotation.SecurityConfigurerAdapter<DefaultSecurityFilterChain,B>
      extended by org.springframework.security.config.annotation.web.configurers.PortMapperConfigurer<H>
All Implemented Interfaces:
SecurityConfigurer<DefaultSecurityFilterChain,H>

public final class PortMapperConfigurer<H extends HttpSecurityBuilder<H>>
extends SecurityConfigurerAdapter<DefaultSecurityFilterChain,B>

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
 class PortMapperConfigurer.HttpPortMapping
          Allows specifying the HTTPS port for a given HTTP port when redirecting between HTTP and HTTPS.
 
Constructor Summary
PortMapperConfigurer()
          Creates a new instance
 
Method Summary
 B disable()
          Disables the AbstractHttpConfigurer by removing it.
 PortMapperConfigurer.HttpPortMapping http(int httpPort)
          Adds a port mapping
 void init(H http)
          Initialize the SecurityBuilder.
 PortMapperConfigurer<H> portMapper(PortMapper portMapper)
          Allows specifying the PortMapper instance.
 T withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
           
 
Methods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter
addObjectPostProcessor, and, configure, getBuilder, postProcess, setBuilder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortMapperConfigurer

public PortMapperConfigurer()
Creates a new instance

Method Detail

portMapper

public PortMapperConfigurer<H> portMapper(PortMapper portMapper)
Allows specifying the PortMapper instance.

Parameters:
portMapper -
Returns:

http

public PortMapperConfigurer.HttpPortMapping http(int httpPort)
Adds a port mapping

Parameters:
httpPort - the HTTP port that maps to a specific HTTPS port.
Returns:
PortMapperConfigurer.HttpPortMapping to define the HTTPS port

init

public void init(H http)
          throws Exception
Description copied from interface: SecurityConfigurer
Initialize the SecurityBuilder. Here only shared state should be created and modified, but not properties on the SecurityBuilder used for building the object. This ensures that the SecurityConfigurer.configure(SecurityBuilder) method uses the correct shared objects when building.

Specified by:
init in interface SecurityConfigurer<DefaultSecurityFilterChain,H extends HttpSecurityBuilder<H>>
Overrides:
init in class SecurityConfigurerAdapter<DefaultSecurityFilterChain,H extends HttpSecurityBuilder<H>>
Throws:
Exception

disable

public B disable()
Disables the AbstractHttpConfigurer by removing it. After doing so a fresh version of the configuration can be applied.

Returns:
the HttpSecurityBuilder for additional customizations

withObjectPostProcessor

public T withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)