Package net.shibboleth.idp.authn

# Class AbstractExtractionAction

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.profile.action.AbstractProfileAction
org.opensaml.profile.action.AbstractConditionalProfileAction
net.shibboleth.idp.profile.AbstractProfileAction
net.shibboleth.idp.authn.AbstractAuthenticationAction
net.shibboleth.idp.authn.AbstractExtractionAction

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `InitializableComponent`, `ProfileAction`, `Aware`, `MessageSource`, `MessageSourceAware`, `Action`

Direct Known Subclasses:
  `ExtractRemoteUser`, `ExtractUserAgentAddress`, `ExtractUserAgentIdentifier`, `ExtractUsernamePasswordFromBasicAuth`, `ExtractUsernamePasswordFromFormRequest`, `ExtractUsernamePasswordFromWSSToken`, `ExtractX509CertificateFromRequest`, `PrePopulateUsername`

public abstract class AbstractExtractionAction extends AbstractAuthenticationAction
A base class for authentication actions that extract usernames for subsequent use.

The base class adds a common mechanism for applying regular expression transforms to the username prior to being added to the context tree.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final org.slf4j.Logger`
`log`
Class logger.
`private boolean`
`lowercase`
Convert to lowercase prior to transforms?
`private List<Pair<Pattern,String>>`
`transforms`
Match patterns and replacement strings to apply.
`private boolean`
`trim`
Trim prior to transforms?
`private boolean`
`uppercase`
Convert to uppercase prior to transforms?
`private BiFunction<ProfileRequestContext,String,String>`
`usernameRemappingStrategy`
Generic hook for remapping username.

## Constructor Summary

Constructors
Constructor
Description
`AbstractExtractionAction()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected String`
`applyTransforms(String input)`
Deprecated, for removal: This API element is subject to removal in a future version.
`protected String`
`applyTransforms(ProfileRequestContext profileRequestContext, String input)`
Apply any configured rules, regular expression replacements, or remapping strategy to an input value and return the result.
`void`
`setLowercase(boolean flag)`
Controls conversion to lowercase prior to applying any transforms.
`void`
`setTransforms(Collection<Pair<String,String>> newTransforms)`
A collection of regular expression and replacement pairs.
`void`
`setTrim(boolean flag)`
Controls whitespace trimming prior to applying any transforms.
`void`
`setUppercase(boolean flag)`
Controls conversion to uppercase prior to applying any transforms.
`void`
`setUsernameRemappingStrategy(BiFunction<ProfileRequestContext,String,String> strategy)`
Sets a general hook for remapping username.

### Methods inherited from class net.shibboleth.idp.authn.AbstractAuthenticationAction

`doExecute, doExecute, doPreExecute, doPreExecute, setAuthenticationContextLookupStrategy`

### Methods inherited from class net.shibboleth.idp.profile.AbstractProfileAction

`doExecute, execute, getBean, getBean, getMessage, getMessage, getMessage, getParameter, getParameter, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategy`

### Methods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction

`getActivationCondition, setActivationCondition`

### Methods inherited from class org.opensaml.profile.action.AbstractProfileAction

`doPostExecute, doPostExecute, ensureHttpServletRequest, ensureHttpServletResponse, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, isPreExecuteCalled, setHttpServletRequestSupplier, setHttpServletResponseSupplier`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, doInitialize, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized`

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

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

### Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

`initialize, isInitialized`

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### transforms

@Nonnull private List<Pair<Pattern,String>> transforms
Match patterns and replacement strings to apply.

### uppercase

private boolean uppercase
Convert to uppercase prior to transforms?

### lowercase

private boolean lowercase
Convert to lowercase prior to transforms?

### trim

private boolean trim
Trim prior to transforms?

### usernameRemappingStrategy

@Nullable private BiFunction<ProfileRequestContext,String,String> usernameRemappingStrategy
Generic hook for remapping username.

## Constructor Details

### AbstractExtractionAction

public AbstractExtractionAction()
Constructor.

## Method Details

### setTransforms

public void setTransforms(@Nullable Collection<Pair<String,String>> newTransforms)
A collection of regular expression and replacement pairs.

Parameters:
  `newTransforms` - collection of replacement transforms

### setUppercase

public void setUppercase(boolean flag)
Controls conversion to uppercase prior to applying any transforms.

Parameters:
  `flag` - uppercase flag

### setLowercase

public void setLowercase(boolean flag)
Controls conversion to lowercase prior to applying any transforms.

Parameters:
  `flag` - lowercase flag

### setTrim

public void setTrim(boolean flag)
Controls whitespace trimming prior to applying any transforms.

Parameters:
  `flag` - trim flag

### setUsernameRemappingStrategy

public void setUsernameRemappingStrategy(@Nullable BiFunction<ProfileRequestContext,String,String> strategy)
Sets a general hook for remapping username.

Parameters:
  `strategy` - username remapping strategy
Since:
  5.1.0

### applyTransforms

@Deprecated(since="5.1.0", forRemoval=true) @Nullable @NotEmpty protected String applyTransforms(@Nullable String input)
Deprecated, for removal: This API element is subject to removal in a future version.
Apply any configured rules, regular expression replacements, or remapping strategy to an input value and return the result.

Parameters:
  `input` - the input string
Returns:
  the result of applying the rules

### applyTransforms

@Nullable @NotEmpty protected String applyTransforms(@Nullable ProfileRequestContext profileRequestContext, @Nullable String input)
Apply any configured rules, regular expression replacements, or remapping strategy to an input value and return the result.

Parameters:
  `profileRequestContext` - profile request context
  `input` - the input string
Returns:
  the result of applying the rules
Since:
  5.1.0