Package org.springframework.security.config.annotation

# Class SecurityConfigurerAdapter<O,B extends SecurityBuilder<O>>

java.lang.Object
org.springframework.security.config.annotation.SecurityConfigurerAdapter<O,B>

Type Parameters:
  `O` - The Object being built by B
  `B` - The Builder that is building O and is configured by `SecurityConfigurerAdapter`

All Implemented Interfaces:
  `SecurityConfigurer<O,B>`

Direct Known Subclasses:
  `AbstractHttpConfigurer`, `LdapAuthenticationProviderConfigurer`, `UserDetailsAwareConfigurer`

public abstract class SecurityConfigurerAdapter<O,B extends SecurityBuilder<O>> extends Object implements SecurityConfigurer<O,B>
A base class for `SecurityConfigurer` that allows subclasses to only implement the methods they are interested in. It also provides a mechanism for using the `SecurityConfigurer` and when done gaining access to the `SecurityBuilder` that is being configured.

## Constructor Summary

Constructors
Constructor
Description
`SecurityConfigurerAdapter()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)`
Deprecated, for removal: This API element is subject to removal in a future version.
`void`
`addObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)`
Adds an `ObjectPostProcessor` to be used for this `SecurityConfigurerAdapter`.
`B`
`and()`
Deprecated, for removal: This API element is subject to removal in a future version.
For removal in 7.0.
`void`
`configure(B builder)`
Configure the `SecurityBuilder` by setting the necessary properties on the `SecurityBuilder`.
`protected final B`
`getBuilder()`
Gets the `SecurityBuilder`.
`void`
`init(B builder)`
Initialize the `SecurityBuilder`.
`protected <T> T`
`postProcess(T object)`
Performs post processing of an object.
`void`
`setBuilder(B builder)`
Sets the `SecurityBuilder` to be used.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SecurityConfigurerAdapter

public SecurityConfigurerAdapter()

## Method Details

### init

public void init(B builder) 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. Configurers should be applied here.

Specified by:
  `init` in interface `SecurityConfigurer<O,B extends SecurityBuilder<O>>`
Throws:
  `Exception`

### configure

public void configure(B builder) throws Exception
Description copied from interface: `SecurityConfigurer`
Configure the `SecurityBuilder` by setting the necessary properties on the `SecurityBuilder`.

Specified by:
  `configure` in interface `SecurityConfigurer<O,B extends SecurityBuilder<O>>`
Throws:
  `Exception`

### and

@Deprecated(since="6.1", forRemoval=true) public B and()
Deprecated, for removal: This API element is subject to removal in a future version.
For removal in 7.0. Use the lambda based configuration instead.
Return the `SecurityBuilder` when done using the `SecurityConfigurer`. This is useful for method chaining.

Returns:
  the `SecurityBuilder` for further customizations

### getBuilder

protected final B getBuilder()
Gets the `SecurityBuilder`. Cannot be null.

Returns:
  the `SecurityBuilder`
Throws:
  `IllegalStateException` - if `SecurityBuilder` is null

### postProcess

protected <T> T postProcess(T object)
Performs post processing of an object. The default is to delegate to the `ObjectPostProcessor`.

Parameters:
  `object` - the Object to post process
Returns:
  the possibly modified Object to use

### addObjectPostProcessor

public void addObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
Adds an `ObjectPostProcessor` to be used for this `SecurityConfigurerAdapter`. The default implementation does nothing to the object.

Parameters:
  `objectPostProcessor` - the `ObjectPostProcessor` to use

### addObjectPostProcessor

@Deprecated(since="6.4", forRemoval=true) public void addObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
Deprecated, for removal: This API element is subject to removal in a future version.

### setBuilder

public void setBuilder(B builder)
Sets the `SecurityBuilder` to be used. This is automatically set when using `AbstractConfiguredSecurityBuilder.apply(SecurityConfigurerAdapter)`

Parameters:
  `builder` - the `SecurityBuilder` to set