Package net.shibboleth.profile.relyingparty.impl

# Class DefaultRelyingPartyConfigurationResolver

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.profile.relyingparty.impl.DefaultRelyingPartyConfigurationResolver

All Implemented Interfaces:
  `RelyingPartyConfigurationResolver`, `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`, `Resolver<RelyingPartyConfiguration,CriteriaSet>`

public class DefaultRelyingPartyConfigurationResolver extends AbstractIdentifiableInitializableComponent implements RelyingPartyConfigurationResolver
Retrieves a per-relying party configuration for a given profile request based on the supplied `CriteriaSet`.

Supported `Criterion`:

- `ProfileRequestContextCriterion`
- `EntityIdCriterion`
- `RoleDescriptorCriterion`
- `VerifiedProfileCriterion`

Note that this resolver does not permit more than one `RelyingPartyConfiguration` with the same ID.

Since:
  5.0.0

## Field Summary

Fields
Modifier and Type
Field
Description
`private com.codahale.metrics.Gauge<Map<String,com.codahale.metrics.Counter>>`
`counterGauge`
Stored copy of metric for teardown.
`private Map<String,com.codahale.metrics.Counter>`
`counterMap`
Map of override counters.
`private static final String`
`DEFAULT_RELYING_PARTY_COUNTER`
Counter ID for default RP.
`private RelyingPartyConfiguration`
`defaultRelyingPartyConfiguration`
Default relying party, used if no other verified instance matches.
`private List<Credential>`
`encryptionCredentials`
The global list of all configured encryption credentials.
`private final org.slf4j.Logger`
`log`
Class logger.
`private String`
`metricName`
Name for counter map metric.
`private List<RelyingPartyConfiguration>`
`rpConfigurations`
Registered relying party configurations.
`private List<Credential>`
`signingCredentials`
The global list of all configured signing credentials.
`private static final String`
`UNVERIFIED_RELYING_PARTY_COUNTER`
Counter ID for unverified RP.
`private RelyingPartyConfiguration`
`unverifiedConfiguration`
Unverified relying party configuration, used if the request is unverified.

## Constructor Summary

Constructors
Constructor
Description
`DefaultRelyingPartyConfigurationResolver()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doDestroy()`
`protected void`
`doInitialize()`
`RelyingPartyConfiguration`
`getDefaultConfiguration()`
Get the `RelyingPartyConfiguration` to use if no other configuration is applicable.
`Collection<Credential>`
`getEncryptionCredentials()`
Directly expose any configured encryption (really decryption) credentials.
`String`
`getMetricName()`
Gets the metric name to use to use for counters to track use of configurations.
`private ProfileRequestContext`
`getProfileRequestContext(CriteriaSet criteria)`
Get the `ProfileRequestContext` included in the input criteria, if any.
`Collection<? extends RelyingPartyConfiguration>`
`getRelyingPartyConfigurations()`
Get an unmodifiable list of verified relying party configurations.
`Collection<Credential>`
`getSigningCredentials()`
Directly expose any configured signing credentials.
`RelyingPartyConfiguration`
`getUnverifiedConfiguration()`
Get the `RelyingPartyConfiguration` to use if the configuration is found to be "unverified" (via use of `VerifiedProfileCriterion`).
`private void`
`increment(String name)`
Increment relying party counter.
`Iterable<RelyingPartyConfiguration>`
`resolve(CriteriaSet criteria)`
`private EntityDescriptor`
`resolveEntityDescriptor(CriteriaSet criteria)`
Resolve the EntityDescriptor from the criteria.
`private String`
`resolveEntityID(CriteriaSet criteria)`
Resolve the entityID from the criteria.
`private RoleDescriptor`
`resolveRoleDescriptor(CriteriaSet criteria)`
Resolve the RoleDescriptor from the criteria.
`RelyingPartyConfiguration`
`resolveSingle(CriteriaSet criteria)`
`void`
`setDefaultConfiguration(RelyingPartyConfiguration configuration)`
Set the `RelyingPartyConfiguration` to use if no other configuration is applicable.
`void`
`setEncryptionCredentials(List<CredentialHolder> credentials)`
Set the list of all configured encryption credentials.
`void`
`setMetricName(String name)`
Set name of metric to use for counters to track use of configurations.
`void`
`setRelyingPartyConfigurations(Collection<? extends RelyingPartyConfiguration> configs)`
Set the verified relying party configurations.
`void`
`setSigningCredentials(List<CredentialHolder> credentials)`
Set the list of all configured signing credentials.
`void`
`setUnverifiedConfiguration(RelyingPartyConfiguration configuration)`
Set the `RelyingPartyConfiguration` to use if the configuration is found to be "unverified" (via use of `VerifiedProfileCriterion`).

### 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, 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

### DEFAULT_RELYING_PARTY_COUNTER

@Nonnull @NotEmpty private static final String DEFAULT_RELYING_PARTY_COUNTER
Counter ID for default RP.

See Also:
  - Constant Field Values

### UNVERIFIED_RELYING_PARTY_COUNTER

@Nonnull @NotEmpty private static final String UNVERIFIED_RELYING_PARTY_COUNTER
Counter ID for unverified RP.

See Also:
  - Constant Field Values

### log

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

### rpConfigurations

@Nonnull private List<RelyingPartyConfiguration> rpConfigurations
Registered relying party configurations.

### defaultRelyingPartyConfiguration

@Nullable private RelyingPartyConfiguration defaultRelyingPartyConfiguration
Default relying party, used if no other verified instance matches.

### unverifiedConfiguration

@Nullable private RelyingPartyConfiguration unverifiedConfiguration
Unverified relying party configuration, used if the request is unverified.

### signingCredentials

@Nonnull private List<Credential> signingCredentials
The global list of all configured signing credentials.

### encryptionCredentials

@Nonnull private List<Credential> encryptionCredentials
The global list of all configured encryption credentials.

### metricName

@Nullable private String metricName
Name for counter map metric.

### counterGauge

@Nullable private com.codahale.metrics.Gauge<Map<String,com.codahale.metrics.Counter>> counterGauge
Stored copy of metric for teardown.

### counterMap

@Nonnull private Map<String,com.codahale.metrics.Counter> counterMap
Map of override counters.

## Constructor Details

### DefaultRelyingPartyConfigurationResolver

public DefaultRelyingPartyConfigurationResolver()
Constructor.

## Method Details

### getRelyingPartyConfigurations

@Nonnull @Unmodifiable @NotLive public Collection<? extends RelyingPartyConfiguration> getRelyingPartyConfigurations()
Get an unmodifiable list of verified relying party configurations.

Returns:
  unmodifiable list of verified relying party configurations

### setRelyingPartyConfigurations

public void setRelyingPartyConfigurations(@Nullable Collection<? extends RelyingPartyConfiguration> configs)
Set the verified relying party configurations.

Parameters:
  `configs` - list of verified relying party configurations

### getDefaultConfiguration

@Nullable public RelyingPartyConfiguration getDefaultConfiguration()
Get the `RelyingPartyConfiguration` to use if no other configuration is applicable.

Returns:
  default configuration

### setDefaultConfiguration

public void setDefaultConfiguration(@Nullable RelyingPartyConfiguration configuration)
Set the `RelyingPartyConfiguration` to use if no other configuration is applicable.

Parameters:
  `configuration` - default configuration

### getUnverifiedConfiguration

@Nullable public RelyingPartyConfiguration getUnverifiedConfiguration()
Get the `RelyingPartyConfiguration` to use if the configuration is found to be "unverified" (via use of `VerifiedProfileCriterion`).

Returns:
  unverified configuration

### setUnverifiedConfiguration

public void setUnverifiedConfiguration(@Nullable RelyingPartyConfiguration configuration)
Set the `RelyingPartyConfiguration` to use if the configuration is found to be "unverified" (via use of `VerifiedProfileCriterion`).

Parameters:
  `configuration` - unverified configuration

### getMetricName

@Nullable public String getMetricName()
Gets the metric name to use to use for counters to track use of configurations.

Returns:
  name for counter metrics
Since:
  5.1.3

### setMetricName

public void setMetricName(@Nullable String name)
Set name of metric to use for counters to track use of configurations.

Parameters:
  `name` - name for counter metrics
Since:
  5.0.0

### doInitialize

protected void doInitialize() throws ComponentInitializationException

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

### doDestroy

protected void doDestroy()

Overrides:
  `doDestroy` in class `AbstractInitializableComponent`

### resolve

@Nonnull public Iterable<RelyingPartyConfiguration> resolve(@Nullable CriteriaSet criteria) throws ResolverException

Specified by:
  `resolve` in interface `Resolver<RelyingPartyConfiguration,CriteriaSet>`
Throws:
  `ResolverException`

### resolveSingle

@Nullable public RelyingPartyConfiguration resolveSingle(@Nullable CriteriaSet criteria) throws ResolverException

Specified by:
  `resolveSingle` in interface `Resolver<RelyingPartyConfiguration,CriteriaSet>`
Throws:
  `ResolverException`

### getSigningCredentials

@Nonnull @Unmodifiable @NotLive public Collection<Credential> getSigningCredentials()
Directly expose any configured signing credentials.

Specified by:
  `getSigningCredentials` in interface `RelyingPartyConfigurationResolver`
Returns:
  signing credentials

### setSigningCredentials

@Autowired @Qualifier("signing") public void setSigningCredentials(@Nullable List<CredentialHolder> credentials)
Set the list of all configured signing credentials.

Parameters:
  `credentials` - the list of signing credentials, may be null

### getEncryptionCredentials

@Nonnull @Unmodifiable @NotLive public Collection<Credential> getEncryptionCredentials()
Directly expose any configured encryption (really decryption) credentials.

Specified by:
  `getEncryptionCredentials` in interface `RelyingPartyConfigurationResolver`
Returns:
  signing credentials

### setEncryptionCredentials

@Autowired @Qualifier("encryption") public void setEncryptionCredentials(@Nullable List<CredentialHolder> credentials)
Set the list of all configured encryption credentials.

Parameters:
  `credentials` - the list of encryption credentials, may be null

### increment

private void increment(@Nullable String name)
Increment relying party counter.

Parameters:
  `name` - name of counter

### getProfileRequestContext

@Nullable private ProfileRequestContext getProfileRequestContext(@Nonnull CriteriaSet criteria)
Get the `ProfileRequestContext` included in the input criteria, if any.

Parameters:
  `criteria` - input criteria
Returns:
  embedded profile request context or null

### resolveEntityID

@Nullable private String resolveEntityID(@Nonnull CriteriaSet criteria)
Resolve the entityID from the criteria.

Parameters:
  `criteria` - the input criteria
Returns:
  the input entityID criterion or null if could not be resolved

### resolveEntityDescriptor

@Nullable private EntityDescriptor resolveEntityDescriptor(@Nonnull CriteriaSet criteria)
Resolve the EntityDescriptor from the criteria.

Parameters:
  `criteria` - the input criteria
Returns:
  the input entity descriptor criterion, or null if could not be resolved

### resolveRoleDescriptor

@Nullable private RoleDescriptor resolveRoleDescriptor(@Nonnull CriteriaSet criteria)
Resolve the RoleDescriptor from the criteria.

Parameters:
  `criteria` - the input criteria
Returns:
  the input role descriptor criterion or null if could not be resolved