Package net.shibboleth.idp.saml.nameid.impl

# Class NameIDCanonicalization

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.authn.SubjectCanonicalizationFlowDescriptor
net.shibboleth.idp.saml.nameid.NameIDCanonicalizationFlowDescriptor
net.shibboleth.idp.saml.nameid.AbstractNameIDCanonicalizer
net.shibboleth.idp.saml.nameid.impl.NameIDCanonicalization

All Implemented Interfaces:
  `Function<SubjectCanonicalizationContext,String>`, `Predicate<ProfileRequestContext>`, `SubjectCanonicalizer`, `FlowDescriptor`, `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`

public class NameIDCanonicalization extends AbstractNameIDCanonicalizer
A `SubjectCanonicalizer` that transforms the input `Subject` into a principal name by searching for one and only one `NameIDPrincipal` custom principal, using an injected `NameIDDecoder` to carry out the process.

## Field Summary

Fields
Modifier and Type
Field
Description
`private NameIDDecoder`
`decoder`
Supplies logic for decoding the `NameID` into a principal.
`private org.slf4j.Logger`
`log`
Class logger.

## Constructor Summary

Constructors
Constructor
Description
`NameIDCanonicalization()`

## Method Summary

Modifier and Type
Method
Description
`protected String`
`doApply(SubjectCanonicalizationContext c14nContext)`
Performs c14n if possible.
`protected void`
`doInitialize()`
`private boolean`
`formatMatches(SubjectCanonicalizationContext c14nContext, String format)`
Check the format against the relevant flow descriptor's format list.
`NameIDDecoder`
`getDecoder()`
Get the class responsible for decoding the `XSString.getValue()` into a principal.
`private NameIDPrincipal`
`getNameIDPrincipal(SubjectCanonicalizationContext c14nContext)`
Helper method that returns the first and only `NameIDPrincipal` provided it matches a valid Format, returning null otherwise.
`void`
`setDecoder(NameIDDecoder theDecoder)`
Set the class responsible for decoding the `XSString.getValue()` into a principal.

### Methods inherited from class net.shibboleth.idp.saml.nameid.AbstractNameIDCanonicalizer

`apply, getLogPrefix`

### Methods inherited from class net.shibboleth.idp.saml.nameid.NameIDCanonicalizationFlowDescriptor

`getFormats, setFormats`

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

`equals, getFlowId, hashCode, setActivationCondition, setFlowId, test, toString`

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

`setId`

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

`ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException`

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

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitialized`

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

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

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

`destroy, isDestroyed`

### Methods inherited from interface java.util.function.Function

`andThen, compose`

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

`setId`

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

`getId`

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

`initialize, isInitialized`

### Methods inherited from interface java.util.function.Predicate

`and, negate, or`

## Field Details

### log

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

### decoder

@NonnullAfterInit private NameIDDecoder decoder
Supplies logic for decoding the `NameID` into a principal.

## Constructor Details

### NameIDCanonicalization

public NameIDCanonicalization()

## Method Details

### getDecoder

@NonnullAfterInit public NameIDDecoder getDecoder()
Get the class responsible for decoding the `XSString.getValue()` into a principal.

Returns:
  the decoder

### setDecoder

public void setDecoder(@Nonnull NameIDDecoder theDecoder)
Set the class responsible for decoding the `XSString.getValue()` into a principal.

Parameters:
  `theDecoder` - the decoder

### doInitialize

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `AbstractNameIDCanonicalizer`
Throws:
  `ComponentInitializationException`

### doApply

@Nullable protected String doApply(@Nonnull SubjectCanonicalizationContext c14nContext)
Performs c14n if possible.

Specified by:
  `doApply` in class `AbstractNameIDCanonicalizer`
Parameters:
  `c14nContext` - the current subject canonicalization context
Returns:
  event indicating result of function

### getNameIDPrincipal

@Nullable private NameIDPrincipal getNameIDPrincipal(@Nonnull SubjectCanonicalizationContext c14nContext)
Helper method that returns the first and only `NameIDPrincipal` provided it matches a valid Format, returning null otherwise.

Parameters:
  `c14nContext` - input context
Returns:
  the only matching principal or null

### formatMatches

private boolean formatMatches(@Nonnull SubjectCanonicalizationContext c14nContext, @Nonnull String format)
Check the format against the relevant flow descriptor's format list.

Parameters:
  `c14nContext` - the current c14n context
  `format` - the format to check
Returns:
  true iff the format matches