Class MetadataPolicy
- java.lang.Object
-
- com.nimbusds.openid.connect.sdk.federation.policy.MetadataPolicy
-
- All Implemented Interfaces:
net.minidev.json.JSONAware
public class MetadataPolicy extends Object implements net.minidev.json.JSONAware
Policy for a federation entity metadata.Example:
{ "scopes" : { "subset_of" : [ "openid", "eduperson", "phone" ], "superset_of" : [ "openid" ], "default" : [ "openid", "eduperson" ] }, "id_token_signed_response_alg" : { "one_of" : [ "ES256", "ES384", "ES512" ] }, "contacts" : { "add" : "helpdesk@federation.example.org" }, "application_type" : { "value": "web" } }Related specifications:
- OpenID Connect Federation 1.0, section 5.1.
-
-
Constructor Summary
Constructors Constructor Description MetadataPolicy()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description net.minidev.json.JSONObjectapply(net.minidev.json.JSONObject metadata)Applies this policy to the specified metadata.static MetadataPolicycombine(List<MetadataPolicy> policies)Combines the specified list of metadata policies.static MetadataPolicycombine(List<MetadataPolicy> policies, PolicyOperationCombinationValidator combinationValidator)Combines the specified list of metadata policies.Set<MetadataPolicyEntry>entrySet()Gets the policy entries set.List<PolicyOperation>get(String parameterName)Gets the policy operations for the specified metadata parameter name.MetadataPolicyEntrygetEntry(String parameterName)Gets the policy entry for the specified metadata parameter name.static MetadataPolicyparse(String policySpec)Parses a policy for a federation entity metadata.static MetadataPolicyparse(String policySpec, PolicyOperationFactory factory, PolicyOperationCombinationValidator combinationValidator)Parses a policy for a federation entity metadata.static MetadataPolicyparse(net.minidev.json.JSONObject policySpec)Parses a policy for a federation entity metadata.static MetadataPolicyparse(net.minidev.json.JSONObject policySpec, PolicyOperationFactory factory, PolicyOperationCombinationValidator combinationValidator)Parses a policy for a federation entity metadata.voidput(MetadataPolicyEntry entry)Puts a policy entry for a metadata parameter.voidput(String parameterName, PolicyOperation policyOperation)Puts a policy entry for a metadata parameter.voidput(String parameterName, List<PolicyOperation> policyOperations)Puts a policy entry for a metadata parameter.List<PolicyOperation>remove(String parameterName)Removes a policy entry.net.minidev.json.JSONObjecttoJSONObject()Returns a JSON object representation of this metadata policy.StringtoJSONString()StringtoString()
-
-
-
Constructor Detail
-
MetadataPolicy
public MetadataPolicy()
-
-
Method Detail
-
apply
public net.minidev.json.JSONObject apply(net.minidev.json.JSONObject metadata) throws PolicyViolationException
Applies this policy to the specified metadata.- Parameters:
metadata- The metadata as JSON object. May benull.- Returns:
- The resulting metadata,
nullif not specified. - Throws:
PolicyViolationException- On a policy violation.
-
put
public void put(String parameterName, PolicyOperation policyOperation)
Puts a policy entry for a metadata parameter.- Parameters:
parameterName- The parameter name. Must not benull.policyOperation- The policy operation for the parameter,nullif none.
-
put
public void put(String parameterName, List<PolicyOperation> policyOperations)
Puts a policy entry for a metadata parameter.- Parameters:
parameterName- The parameter name. Must not benull.policyOperations- The ordered policy operations for the parameter,nullif none.
-
put
public void put(MetadataPolicyEntry entry)
Puts a policy entry for a metadata parameter.- Parameters:
entry- The policy entry. Must not benull.
-
get
public List<PolicyOperation> get(String parameterName)
Gets the policy operations for the specified metadata parameter name.- Parameters:
parameterName- The parameter name. Must not benull.- Returns:
- The ordered policy operations for the parameter,
nullif none.
-
getEntry
public MetadataPolicyEntry getEntry(String parameterName)
Gets the policy entry for the specified metadata parameter name.- Parameters:
parameterName- The parameter name. Must not benull.- Returns:
- The policy entry for the parameter,
nullif none.
-
entrySet
public Set<MetadataPolicyEntry> entrySet()
Gets the policy entries set.- Returns:
- The policy entries set.
-
remove
public List<PolicyOperation> remove(String parameterName)
Removes a policy entry.- Parameters:
parameterName- The parameter name. Must not benull.- Returns:
- The ordered policy operations for the removed parameter,
nullif not found.
-
toJSONObject
public net.minidev.json.JSONObject toJSONObject()
Returns a JSON object representation of this metadata policy.- Returns:
- The JSON object.
-
toJSONString
public String toJSONString()
- Specified by:
toJSONStringin interfacenet.minidev.json.JSONAware
-
combine
public static MetadataPolicy combine(List<MetadataPolicy> policies) throws PolicyViolationException
Combines the specified list of metadata policies. Uses thedefault policy combination validator.- Parameters:
policies- The metadata policies. Must not be empty ornull.- Returns:
- The new combined metadata policy.
- Throws:
PolicyViolationException- On a policy violation.
-
combine
public static MetadataPolicy combine(List<MetadataPolicy> policies, PolicyOperationCombinationValidator combinationValidator) throws PolicyViolationException
Combines the specified list of metadata policies.- Parameters:
policies- The metadata policies. Must not be empty ornull.combinationValidator- The policy operation combination validator. Must not benull.- Returns:
- The new combined metadata policy.
- Throws:
PolicyViolationException- On a policy violation.
-
parse
public static MetadataPolicy parse(net.minidev.json.JSONObject policySpec) throws ParseException, PolicyViolationException
Parses a policy for a federation entity metadata. This method is intended for policies with standardPolicyOperations only. Uses the defaultpolicy operationandpolicy combination validatorfactories.- Parameters:
policySpec- The JSON object string for the policy specification. Must not benull.- Returns:
- The metadata policy.
- Throws:
ParseException- On JSON parsing exception.PolicyViolationException- On a policy violation.
-
parse
public static MetadataPolicy parse(net.minidev.json.JSONObject policySpec, PolicyOperationFactory factory, PolicyOperationCombinationValidator combinationValidator) throws ParseException, PolicyViolationException
Parses a policy for a federation entity metadata. This method is intended for policies including non-standardPolicyOperations.- Parameters:
policySpec- The JSON object for the policy specification. Must not benull.factory- The policy operation factory. Must not benull.combinationValidator- The policy operation combination validator. Must not benull.- Returns:
- The metadata policy.
- Throws:
ParseException- On JSON parsing exception.PolicyViolationException- On a policy violation.
-
parse
public static MetadataPolicy parse(String policySpec) throws ParseException, PolicyViolationException
Parses a policy for a federation entity metadata. This method is intended for policies with standardPolicyOperations only. Uses the defaultpolicy operationandpolicy combination validatorfactories.- Parameters:
policySpec- The JSON object string for the policy specification. Must not benull.- Returns:
- The metadata policy.
- Throws:
ParseException- On JSON parsing exception.PolicyViolationException- On a policy violation.
-
parse
public static MetadataPolicy parse(String policySpec, PolicyOperationFactory factory, PolicyOperationCombinationValidator combinationValidator) throws ParseException, PolicyViolationException
Parses a policy for a federation entity metadata. This method is intended for policies including non-standardPolicyOperations.- Parameters:
policySpec- The JSON object for the policy specification. Must not benull.factory- The policy operation factory. Must not benull.combinationValidator- The policy operation combination validator. Must not benull.- Returns:
- The metadata policy.
- Throws:
ParseException- On JSON parsing exception.PolicyViolationException- On a policy violation.
-
-