Class MetadataPolicyEntry
- java.lang.Object
-
- com.nimbusds.openid.connect.sdk.federation.policy.MetadataPolicyEntry
-
- All Implemented Interfaces:
Map.Entry<String,List<PolicyOperation>>
public class MetadataPolicyEntry extends Object implements Map.Entry<String,List<PolicyOperation>>
Policy entry for a metadata parameter.
-
-
Field Summary
Fields Modifier and Type Field Description static PolicyOperationCombinationValidatorDEFAULT_POLICY_COMBINATION_VALIDATORThe default policy operation combination validator.static PolicyOperationFactoryDEFAULT_POLICY_OPERATION_FACTORYThe default policy operation factory.
-
Constructor Summary
Constructors Constructor Description MetadataPolicyEntry(String parameterName, List<PolicyOperation> policyOperations)Creates a new policy entry for a metadata parameter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectapply(Object value)Applies this policy entry for a metadata parameter to the specified value.MetadataPolicyEntrycombine(MetadataPolicyEntry other)Combines this policy entry with another one for the same parameter name.MetadataPolicyEntrycombine(MetadataPolicyEntry other, PolicyOperationCombinationValidator combinationValidator)Combines this policy entry with another one for the same parameter name.StringgetKey()Map<OperationName,PolicyOperation>getOperationsMap()Returns a map of the operations for this policy entry, in theirstandard execution order.StringgetParameterName()Returns the parameter name.List<PolicyOperation>getPolicyOperations()Returns the policy operations.List<PolicyOperation>getValue()static MetadataPolicyEntryparse(String parameterName, net.minidev.json.JSONObject entrySpec)Parses a policy entry for a metadata parameter.static MetadataPolicyEntryparse(String parameterName, net.minidev.json.JSONObject entrySpec, PolicyOperationFactory factory, PolicyOperationCombinationValidator combinationValidator)Parses a policy entry for a metadata parameter.List<PolicyOperation>setValue(List<PolicyOperation> policyOperations)net.minidev.json.JSONObjecttoJSONObject()Returns a JSON object representation of the policy operations for this entry.
-
-
-
Field Detail
-
DEFAULT_POLICY_OPERATION_FACTORY
public static final PolicyOperationFactory DEFAULT_POLICY_OPERATION_FACTORY
The default policy operation factory.
-
DEFAULT_POLICY_COMBINATION_VALIDATOR
public static final PolicyOperationCombinationValidator DEFAULT_POLICY_COMBINATION_VALIDATOR
The default policy operation combination validator.
-
-
Constructor Detail
-
MetadataPolicyEntry
public MetadataPolicyEntry(String parameterName, List<PolicyOperation> policyOperations)
Creates a new policy entry for a metadata parameter.- Parameters:
parameterName- The parameter name. Must not benull.policyOperations- The policy operations, empty list ornullif none.
-
-
Method Detail
-
getParameterName
public String getParameterName()
Returns the parameter name.- Returns:
- The parameter name.
- See Also:
getKey()
-
getKey
public String getKey()
- Specified by:
getKeyin interfaceMap.Entry<String,List<PolicyOperation>>- See Also:
getParameterName()
-
getPolicyOperations
public List<PolicyOperation> getPolicyOperations()
Returns the policy operations.- Returns:
- The policy operations, empty list if none.
- See Also:
getValue()
-
getValue
public List<PolicyOperation> getValue()
- Specified by:
getValuein interfaceMap.Entry<String,List<PolicyOperation>>- See Also:
getPolicyOperations()
-
setValue
public List<PolicyOperation> setValue(List<PolicyOperation> policyOperations)
- Specified by:
setValuein interfaceMap.Entry<String,List<PolicyOperation>>
-
getOperationsMap
public Map<OperationName,PolicyOperation> getOperationsMap()
Returns a map of the operations for this policy entry, in theirstandard execution order. Non-standard (custom) policy operations will be put at the end, in no particular order between them.- Returns:
- The map, empty if no operations.
-
combine
public MetadataPolicyEntry combine(MetadataPolicyEntry other) throws PolicyViolationException
Combines this policy entry with another one for the same parameter name. Uses thedefault policy combination validator.- Parameters:
other- The other policy entry. Must not benull.- Returns:
- The new combined policy entry.
- Throws:
PolicyViolationException- If the parameter names don't match or another violation was encountered.
-
combine
public MetadataPolicyEntry combine(MetadataPolicyEntry other, PolicyOperationCombinationValidator combinationValidator) throws PolicyViolationException
Combines this policy entry with another one for the same parameter name.- Parameters:
other- The other policy entry. Must not benull.combinationValidator- The policy operation combination validator. Must not benull.- Returns:
- The new combined policy entry.
- Throws:
PolicyViolationException- If the parameter names don't match or another violation was encountered.
-
apply
public Object apply(Object value) throws PolicyViolationException
Applies this policy entry for a metadata parameter to the specified value.- Parameters:
value- The parameter value,nullif not specified.- Returns:
- The resulting value, can be
null. - Throws:
PolicyViolationException- On a policy violation.
-
toJSONObject
public net.minidev.json.JSONObject toJSONObject()
Returns a JSON object representation of the policy operations for this entry.- Returns:
- The JSON object keeping the ordering of the members.
-
parse
public static MetadataPolicyEntry parse(String parameterName, net.minidev.json.JSONObject entrySpec) throws ParseException, PolicyViolationException
Parses a policy entry for a metadata parameter. This method is intended for policies with standardPolicyOperations only. Uses the defaultpolicy operationandpolicy combination validatorfactories.- Parameters:
parameterName- The parameter name. Must not benull.entrySpec- The JSON object entry specification, must not benull.- Returns:
- The policy entry for the metadata parameter.
- Throws:
ParseException- On JSON parsing exception.PolicyViolationException- On a policy violation.
-
parse
public static MetadataPolicyEntry parse(String parameterName, net.minidev.json.JSONObject entrySpec, PolicyOperationFactory factory, PolicyOperationCombinationValidator combinationValidator) throws ParseException, PolicyViolationException
Parses a policy entry for a metadata parameter. This method is intended for policies including non-standardPolicyOperations.- Parameters:
parameterName- The parameter name. Must not benull.entrySpec- The JSON object entry specification, must not benull.factory- The policy operation factory. Must not benull.combinationValidator- The policy operation combination validator. Must not benull.- Returns:
- The policy entry for the metadata parameter.
- Throws:
ParseException- On JSON parsing exception.PolicyViolationException- On a policy violation.
-
-