Class AttributeConsumingServiceSelector
java.lang.Object
org.opensaml.saml.metadata.support.AttributeConsumingServiceSelector
public class AttributeConsumingServiceSelector extends Object
Metadata support class which selects an
AttributeConsumingService
based on input of a mandatory
RoleDescriptor
and an optional index.
This implementation supports selecting an AttributeConsumingService from parent role descriptors of the following types:
- the standard SAML 2 metadata type
SPSSODescriptor
- the extension type
AttributeQueryDescriptorType
Subclasses should override getCandidates()
if support for additional sources of attribute consuming services
is needed.
The selection algorithm is:
- If an index is supplied, the service with that index is returned. If no such service exists in metadata: if
isOnBadIndexUseDefault()
is true, then the default service is returned as described below; otherwise null is returned. - If an index is not supplied, then the default service is returned as follows: The service with an explicit isDefault of true is returned. If no such service exists, then the first service without an explicit isDefault is returned. If no service is yet selected, then the first service listed in metadata is returned.
-
Field Summary
Fields Modifier and Type Field Description private Integer
index
The requested service index.private org.slf4j.Logger
log
Class logger.private boolean
onBadIndexUseDefault
Flag which determines whether, in the case of an invalid index, to return the default AttributeConsumingService.private RoleDescriptor
roleDescriptor
The AttributeConsumingService's parent role descriptor. -
Constructor Summary
Constructors Constructor Description AttributeConsumingServiceSelector()
-
Method Summary
Modifier and Type Method Description protected List<AttributeConsumingService>
getCandidates()
Get the list of candidate attribute consuming services.Integer
getIndex()
Get the index of the desired service.RoleDescriptor
getRoleDescriptor()
Get the AttributeConsumingServie's parent RoleDescriptor.boolean
isOnBadIndexUseDefault()
Get the flag which determines whether, in the case of an invalid index, to return the default AttributeConsumingService.private AttributeConsumingService
selectByIndex(List<AttributeConsumingService> candidates)
Select the service based on the index value.private AttributeConsumingService
selectDefault(List<AttributeConsumingService> candidates)
Select the default service.AttributeConsumingService
selectService()
Select the AttributeConsumingService.void
setIndex(Integer requestedIndex)
Set the index of the desired service.void
setOnBadIndexUseDefault(boolean flag)
Set the flag which determines whether, in the case of an invalid index, to return the default AttributeConsumingService.void
setRoleDescriptor(RoleDescriptor descriptor)
Set the AttributeConsumingServie's parent RoleDescriptor.
-
Field Details
-
log
private org.slf4j.Logger logClass logger. -
index
The requested service index. -
roleDescriptor
The AttributeConsumingService's parent role descriptor. -
onBadIndexUseDefault
private boolean onBadIndexUseDefaultFlag which determines whether, in the case of an invalid index, to return the default AttributeConsumingService.
-
-
Constructor Details
-
AttributeConsumingServiceSelector
public AttributeConsumingServiceSelector()
-
-
Method Details
-
getIndex
Get the index of the desired service.- Returns:
- Returns the index.
-
setIndex
Set the index of the desired service.- Parameters:
requestedIndex
- The index to set.
-
getRoleDescriptor
Get the AttributeConsumingServie's parent RoleDescriptor.- Returns:
- Returns the spSSODescriptor.
-
setRoleDescriptor
Set the AttributeConsumingServie's parent RoleDescriptor.- Parameters:
descriptor
- The roleDescriptor to set.
-
setOnBadIndexUseDefault
public void setOnBadIndexUseDefault(boolean flag)Set the flag which determines whether, in the case of an invalid index, to return the default AttributeConsumingService. Defaults to false.- Parameters:
flag
- The onBadIndexUseDefault to set.
-
isOnBadIndexUseDefault
public boolean isOnBadIndexUseDefault()Get the flag which determines whether, in the case of an invalid index, to return the default AttributeConsumingService. Defaults to false.- Returns:
- Returns the onBadIndexUseDefault.
-
selectService
Select the AttributeConsumingService.- Returns:
- the selected AttributeConsumingService, or null
-
getCandidates
Get the list of candidate attribute consuming services.This implementation supports selecting an AttributeConsumingService from parent role descriptors of the following types:
- the standard SAML 2 metadata type
SPSSODescriptor
- the extension type
AttributeQueryDescriptorType
Subclasses should override if support for additional sources of attribute consuming services is needed.
- Returns:
- the list of candidate AttributeConsumingServices, or null if none could be resolved
- the standard SAML 2 metadata type
-
selectByIndex
Select the service based on the index value.- Parameters:
candidates
- the list of candiate services- Returns:
- the selected candidate or null
-
selectDefault
Select the default service.- Parameters:
candidates
- the list of candiate services- Returns:
- the selected candidate or null
-