Class MetadataPolicy
java.lang.Object
com.nimbusds.openid.connect.sdk.federation.policy.MetadataPolicy
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionnet.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.entrySet()Gets the policy entries set.Gets the policy operations for the specified metadata parameter name.Gets the policy entry for the specified metadata parameter name.static MetadataPolicyParses 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.Removes a policy entry.net.minidev.json.JSONObjectReturns a JSON object representation of this metadata policy.toString()
-
Constructor Details
-
MetadataPolicy
public MetadataPolicy()
-
-
Method Details
-
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
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
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
Puts a policy entry for a metadata parameter.- Parameters:
entry- The policy entry. Must not benull.
-
get
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
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
Gets the policy entries set.- Returns:
- The policy entries set.
-
remove
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
Returns a JSON object representation of this metadata policy.- Returns:
- The JSON object.
-
toJSONString
- Specified by:
toJSONStringin interfacenet.minidev.json.JSONAware
-
toString
-
combine
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.
-