Package org.opensaml.saml.common.profile.logic

# Class AbstractNameIDPolicyPredicate

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.saml.common.profile.logic.AbstractNameIDPolicyPredicate

All Implemented Interfaces:
  `Predicate<ProfileRequestContext>`, `Component`, `DestructableComponent`, `InitializableComponent`

Direct Known Subclasses:
  `DefaultNameIDPolicyPredicate`

public abstract class AbstractNameIDPolicyPredicate extends AbstractInitializableComponent implements Predicate<ProfileRequestContext>
Base class for implementations of `Predicate` that handle evaluation of name identifier content in various scenarios.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Set<String>`
`formats`
Formats to apply policy to.
`private final org.slf4j.Logger`
`log`
Class logger.
`private Function<ProfileRequestContext,SAMLObject>`
`objectLookupStrategy`
Object lookup function.
`private Function<ProfileRequestContext,String>`
`requesterIdLookupStrategy`
Requester ID lookup function.
`private Function<ProfileRequestContext,String>`
`responderIdLookupStrategy`
Responder ID lookup function.

## Constructor Summary

Constructors
Constructor
Description
`AbstractNameIDPolicyPredicate()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected abstract boolean`
`doApply(String requesterId, String responderId, String format, String nameQualifier, String spNameQualifier)`
Apply the predicate to the request.
`private boolean`
`doApply(ProfileRequestContext input, NameIdentifier target)`
Apply policy to the target object.
`private boolean`
`doApply(ProfileRequestContext input, NameID target)`
Apply policy to the target object.
`private boolean`
`doApply(ProfileRequestContext input, NameIDPolicy target)`
Apply policy to the target object.
`protected void`
`doInitialize()`
`void`
`setFormats(Collection<String> newFormats)`
Set the formats to apply the predicate to.
`void`
`setObjectLookupStrategy(Function<ProfileRequestContext,SAMLObject> strategy)`
Set the lookup strategy used to locate the object to evaluate.
`void`
`setRequesterIdLookupStrategy(Function<ProfileRequestContext,String> strategy)`
Set the strategy used to locate the requester ID.
`void`
`setResponderIdLookupStrategy(Function<ProfileRequestContext,String> strategy)`
Set the strategy used to locate the responder ID.
`boolean`
`test(ProfileRequestContext input)`

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

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, 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 java.util.function.Predicate

`and, negate, or`

## Field Details

### log

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

### requesterIdLookupStrategy

@Nullable private Function<ProfileRequestContext,String> requesterIdLookupStrategy
Requester ID lookup function.

### responderIdLookupStrategy

@Nullable private Function<ProfileRequestContext,String> responderIdLookupStrategy
Responder ID lookup function.

### objectLookupStrategy

@NonnullAfterInit private Function<ProfileRequestContext,SAMLObject> objectLookupStrategy
Object lookup function.

### formats

@Nonnull private Set<String> formats
Formats to apply policy to.

## Constructor Details

### AbstractNameIDPolicyPredicate

public AbstractNameIDPolicyPredicate()
Constructor.

## Method Details

### setRequesterIdLookupStrategy

public void setRequesterIdLookupStrategy(@Nullable Function<ProfileRequestContext,String> strategy)
Set the strategy used to locate the requester ID.

Parameters:
  `strategy` - lookup strategy

### setResponderIdLookupStrategy

public void setResponderIdLookupStrategy(@Nullable Function<ProfileRequestContext,String> strategy)
Set the strategy used to locate the responder ID.

Parameters:
  `strategy` - lookup strategy

### setObjectLookupStrategy

public void setObjectLookupStrategy(@Nullable Function<ProfileRequestContext,SAMLObject> strategy)
Set the lookup strategy used to locate the object to evaluate.

Parameters:
  `strategy` - lookup function

### setFormats

public void setFormats(@Nullable Collection<String> newFormats)
Set the formats to apply the predicate to.

Parameters:
  `newFormats` - formats to apply predicate to

### doInitialize

protected void doInitialize() throws ComponentInitializationException

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

### test

public boolean test(@Nullable ProfileRequestContext input)

Specified by:
  `test` in interface `Predicate<ProfileRequestContext>`

### doApply

private boolean doApply(@Nullable ProfileRequestContext input, @Nonnull NameIdentifier target)
Apply policy to the target object.

Parameters:
  `input` - current profile request context
  `target` - target object
Returns:
  result of policy

### doApply

private boolean doApply(@Nullable ProfileRequestContext input, @Nonnull NameID target)
Apply policy to the target object.

Parameters:
  `input` - current profile request context
  `target` - target object
Returns:
  result of policy

### doApply

private boolean doApply(@Nullable ProfileRequestContext input, @Nonnull NameIDPolicy target)
Apply policy to the target object.

Parameters:
  `input` - current profile request context
  `target` - target object
Returns:
  result of policy

### doApply

protected abstract boolean doApply(@Nullable String requesterId, @Nullable String responderId, @Nullable String format, @Nullable String nameQualifier, @Nullable String spNameQualifier)
Apply the predicate to the request.

Parameters:
  `requesterId` - the requester
  `responderId` - the responder
  `format` - format of identifier
  `nameQualifier` - the NameQualifier
  `spNameQualifier` - the SPNameQualifier
Returns:
  true iff the combination of inputs satisfies a policy