Package net.shibboleth.idp.profile.context

# Class MultiRelyingPartyContext

java.lang.Object
org.opensaml.messaging.context.BaseContext
net.shibboleth.idp.profile.context.MultiRelyingPartyContext

All Implemented Interfaces:
  `Iterable<BaseContext>`

public final class MultiRelyingPartyContext extends BaseContext
`BaseContext` representing multiple relying parties involved in a request, usually a subcontext of `ProfileRequestContext`.

The multiple parties may be accessed as a collection, by their name, or by "labels", which are specific to a given profile/scenario.

The context also provides state management for flows to iterate over the relying parties in the context using an iterator and a "current" pointer.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`private class`
`MultiRelyingPartyContext.RelyingPartyContextIterator`
Wrapper for an iterator that tracks the current object.

## Nested classes/interfaces inherited from class org.opensaml.messaging.context.BaseContext

`BaseContext.ContextSetNoRemoveIteratorDecorator, BaseContext.DeprecatedContextClassNameLookAside`

## Field Summary

Fields
Modifier and Type
Field
Description
`private Map<String,RelyingPartyContext>`
`relyingPartyIdMap`
Map of RP contexts indexed by name.
`private Iterator<RelyingPartyContext>`
`relyingPartyIterator`
An iterator to track progress through the set of relying parties.
`private ListMultimap<String,RelyingPartyContext>`
`relyingPartyLabelMap`
Multimap of RP contexts indexed by role.

## Constructor Summary

Constructors
Constructor
Description
`MultiRelyingPartyContext()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`addRelyingPartyContext(String label, RelyingPartyContext context)`
Add a RP context associated with a label.
`RelyingPartyContext`
`getCurrentRelyingPartyContext()`
Get the `RelyingPartyContext` pointed to by an iterator.
`RelyingPartyContext`
`getRelyingPartyContextById(String id)`
Get a RP context by name/id.
`Iterator<RelyingPartyContext>`
`getRelyingPartyContextIterator()`
Equivalent to calling `getRelyingPartyContextIterator(boolean)` with a parameter of "false".
`Iterator<RelyingPartyContext>`
`getRelyingPartyContextIterator(boolean fresh)`
Get an iterator over the relying parties contained in the context.
`Collection<RelyingPartyContext>`
`getRelyingPartyContexts()`
Get an immutable collection of the RP contexts.
`Collection<RelyingPartyContext>`
`getRelyingPartyContexts(String label)`
Get an immutable collection of RP contexts associated with a label.
`void`
`removeRelyingPartyContext(String label, RelyingPartyContext context)`
Remove a RP context associated with a label.

### Methods inherited from class org.opensaml.messaging.context.BaseContext

`addSubcontext, addSubcontext, clearSubcontexts, containsSubcontext, createSubcontext, ensureSubcontext, ensureSubcontext, getParent, getSubcontext, getSubcontext, getSubcontext, getSubcontext, iterator, removeFromParent, removeSubcontext, removeSubcontext, setParent`

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

## Field Details

### relyingPartyIdMap

@Nonnull private Map<String,RelyingPartyContext> relyingPartyIdMap
Map of RP contexts indexed by name.

### relyingPartyLabelMap

@Nonnull private ListMultimap<String,RelyingPartyContext> relyingPartyLabelMap
Multimap of RP contexts indexed by role.

### relyingPartyIterator

@Nullable private Iterator<RelyingPartyContext> relyingPartyIterator
An iterator to track progress through the set of relying parties.

## Constructor Details

### MultiRelyingPartyContext

public MultiRelyingPartyContext()
Constructor.

## Method Details

### getRelyingPartyContexts

@Nonnull @NotLive @Unmodifiable public Collection<RelyingPartyContext> getRelyingPartyContexts()
Get an immutable collection of the RP contexts.

Returns:
  immutable collection of RP contexts

### getRelyingPartyContexts

@Nonnull @NotLive @Unmodifiable public Collection<RelyingPartyContext> getRelyingPartyContexts(@Nonnull @NotEmpty String label)
Get an immutable collection of RP contexts associated with a label.

Parameters:
  `label` - the label to search for
Returns:
  corresponding RP contexts

### getRelyingPartyContextById

@Nullable public RelyingPartyContext getRelyingPartyContextById(@Nonnull @NotEmpty String id)
Get a RP context by name/id.

Parameters:
  `id` - the identifier to search for
Returns:
  a corresponding RP context

### getRelyingPartyContextIterator

@Nonnull public Iterator<RelyingPartyContext> getRelyingPartyContextIterator(boolean fresh)
Get an iterator over the relying parties contained in the context.

The first time this method is called, or if the parameter is set, it will return a fresh iterator; subsequent calls will return the same iterator.

Modification of the underlying collection while iterating is not supported.

Parameters:
  `fresh` - if true, a new iterator will be created and returned
Returns:
  an iterator over the relying parties contained in the context

### getRelyingPartyContextIterator

@Nonnull public Iterator<RelyingPartyContext> getRelyingPartyContextIterator()
Equivalent to calling `getRelyingPartyContextIterator(boolean)` with a parameter of "false".

Returns:
  an iterator over the relying parties contained in the context

### getCurrentRelyingPartyContext

@Nullable public RelyingPartyContext getCurrentRelyingPartyContext()
Get the `RelyingPartyContext` pointed to by an iterator.

Returns:
  the current position of the last iterator returned by `getRelyingPartyContextIterator()`.

### addRelyingPartyContext

public void addRelyingPartyContext(@Nonnull @NotEmpty String label, @Nonnull RelyingPartyContext context)
Add a RP context associated with a label.

Parameters:
  `label` - the label to associate with the context
  `context` - context to add

### removeRelyingPartyContext

public void removeRelyingPartyContext(@Nonnull @NotEmpty String label, @Nonnull RelyingPartyContext context)
Remove a RP context associated with a label.

Parameters:
  `label` - the label associated with the context
  `context` - context to remove