Package org.opensaml.profile.logic

# Class PredicateAccessControl

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
org.opensaml.profile.logic.PredicateAccessControl

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`, `AccessControl`

public class PredicateAccessControl extends AbstractIdentifiableInitializableComponent implements AccessControl
Access control implementation based on a predicate over a `ProfileRequestContext`.

To bridge the two designs, this adapter populates an `AccessControlContext` placed beneath the `ProfileRequestContext` to carry the operation and resource parameters and allow access to them from the `Predicate`.

Since:
  3.3.0

## Field Summary

Fields
Modifier and Type
Field
Description
`private final org.slf4j.Logger`
`log`
Class logger.
`private final Predicate<ProfileRequestContext>`
`predicate`
The predicate to use.

## Constructor Summary

Constructors
Constructor
Description
`PredicateAccessControl(Predicate<ProfileRequestContext> condition)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`checkAccess(ServletRequest request, String operation, String resource)`
`private String`
`getLogPrefix()`
Get logging prefix.

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

`setId`

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

`doInitialize, 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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

`getId`

## Field Details

### log

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

### predicate

@Nonnull private final Predicate<ProfileRequestContext> predicate
The predicate to use.

## Constructor Details

### PredicateAccessControl

public PredicateAccessControl(@Nonnull @ParameterName(name="condition") Predicate<ProfileRequestContext> condition)
Constructor.

Parameters:
  `condition` - the predicate to use

## Method Details

### checkAccess

public boolean checkAccess(@Nonnull ServletRequest request, @Nullable String operation, @Nullable String resource)

Specified by:
  `checkAccess` in interface `AccessControl`

### getLogPrefix

@Nonnull private String getLogPrefix()
Get logging prefix.

Returns:
  prefix