Package net.shibboleth.idp.authn.revocation.impl

# Class RevocationCacheCondition

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.authn.revocation.impl.RevocationCacheCondition

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

public class RevocationCacheCondition extends AbstractInitializableComponent implements BiPredicate<ProfileRequestContext,AuthenticationResult>
A condition for login flows that checks for revocation against a `RevocationCache`.

Since:
  4.3.0

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`ADDRESS_REVOCATION_PREFIX`
Prefix of keys for address-based revocation.
`private NonnullSupplier<HttpServletRequest>`
`httpServletRequestSupplier`
Servlet request Supplier.
`private final org.slf4j.Logger`
`log`
Class logger.
`static final String`
`PRINCIPAL_REVOCATION_PREFIX`
Prefix of keys for principal-based revocation.
`private Function<ProfileRequestContext,String>`
`principalNameLookupStrategy`
Lookup strategy for principal name.
`static final String`
`REVOCATION_CONTEXT`
Revocation context.
`private RevocationCache`
`revocationCache`
Cache to use.

## Constructor Summary

Constructors
Constructor
Description
`RevocationCacheCondition()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doInitialize()`
`protected boolean`
`isRevoked(String principal, AuthenticationResult result, Collection<String> revocationRecords)`
Check the revocation records' timestamps for applicability.
`void`
`setHttpServletRequestSupplier(NonnullSupplier<HttpServletRequest> supplier)`
Set `HttpServletRequest` in order to obtain client address.
`void`
`setPrincipalNameLookupStrategy(Function<ProfileRequestContext,String> strategy)`
Set lookup strategy for principal name.
`void`
`setRevocationCache(RevocationCache cache)`
Set `RevocationCache` to use.
`boolean`
`test(ProfileRequestContext input, AuthenticationResult input2)`

### 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.BiPredicate

`and, negate, or`

## Field Details

### REVOCATION_CONTEXT

@Nonnull @NotEmpty public static final String REVOCATION_CONTEXT
Revocation context.

See Also:
  - Constant Field Values

### PRINCIPAL_REVOCATION_PREFIX

@Nonnull @NotEmpty public static final String PRINCIPAL_REVOCATION_PREFIX
Prefix of keys for principal-based revocation.

See Also:
  - Constant Field Values

### ADDRESS_REVOCATION_PREFIX

@Nonnull @NotEmpty public static final String ADDRESS_REVOCATION_PREFIX
Prefix of keys for address-based revocation.

See Also:
  - Constant Field Values

### log

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

### revocationCache

@NonnullAfterInit private RevocationCache revocationCache
Cache to use.

### principalNameLookupStrategy

@NonnullAfterInit private Function<ProfileRequestContext,String> principalNameLookupStrategy
Lookup strategy for principal name.

### httpServletRequestSupplier

@Nullable private NonnullSupplier<HttpServletRequest> httpServletRequestSupplier
Servlet request Supplier.

## Constructor Details

### RevocationCacheCondition

public RevocationCacheCondition()

## Method Details

### setRevocationCache

public void setRevocationCache(@Nonnull RevocationCache cache)
Set `RevocationCache` to use.

Parameters:
  `cache` - cache to use

### setPrincipalNameLookupStrategy

public void setPrincipalNameLookupStrategy(@Nonnull Function<ProfileRequestContext,String> strategy)
Set lookup strategy for principal name.

Parameters:
  `strategy` - lookup strategy

### setHttpServletRequestSupplier

public void setHttpServletRequestSupplier(@Nullable NonnullSupplier<HttpServletRequest> supplier)
Set `HttpServletRequest` in order to obtain client address.

Parameters:
  `supplier` - servlet request interface

### doInitialize

protected void doInitialize() throws ComponentInitializationException

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

### test

public boolean test(@Nullable ProfileRequestContext input, @Nullable AuthenticationResult input2)

Specified by:
  `test` in interface `BiPredicate<ProfileRequestContext,AuthenticationResult>`

### isRevoked

protected boolean isRevoked(@Nonnull @NotEmpty String principal, @Nonnull AuthenticationResult result, @Nonnull Collection<String> revocationRecords)
Check the revocation records' timestamps for applicability.

Parameters:
  `principal` - name of principal
  `result` - active result being checked
  `revocationRecords` - the records from the cache
Returns:
  true iff the revocation applies to this result