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" : "[email protected]" }, "application_type" : { "value": "web" } }
Related specifications:
- OpenID Connect Federation 1.0, section 5.1.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnet.minidev.json.JSONObject
apply
(net.minidev.json.JSONObject metadata) Applies this policy to the specified metadata.static MetadataPolicy
combine
(List<MetadataPolicy> policies) Combines the specified list of metadata policies.static MetadataPolicy
combine
(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 MetadataPolicy
Parses a policy for a federation entity metadata.static MetadataPolicy
parse
(String policySpec, PolicyOperationFactory factory, PolicyOperationCombinationValidator combinationValidator) Parses a policy for a federation entity metadata.static MetadataPolicy
parse
(net.minidev.json.JSONObject policySpec) Parses a policy for a federation entity metadata.static MetadataPolicy
parse
(net.minidev.json.JSONObject policySpec, PolicyOperationFactory factory, PolicyOperationCombinationValidator combinationValidator) Parses a policy for a federation entity metadata.void
put
(MetadataPolicyEntry entry) Puts a policy entry for a metadata parameter.void
put
(String parameterName, PolicyOperation policyOperation) Puts a policy entry for a metadata parameter.void
put
(String parameterName, List<PolicyOperation> policyOperations) Puts a policy entry for a metadata parameter.Removes a policy entry.net.minidev.json.JSONObject
Returns 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,
null
if 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,null
if 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,null
if 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,
null
if 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,
null
if 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,
null
if not found.
-
toJSONObject
Returns a JSON object representation of this metadata policy.- Returns:
- The JSON object.
-
toJSONString
- Specified by:
toJSONString
in 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 standardPolicyOperation
s only. Uses the defaultpolicy operation
andpolicy combination validator
factories.- 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-standardPolicyOperation
s.- 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 standardPolicyOperation
s only. Uses the defaultpolicy operation
andpolicy combination validator
factories.- 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-standardPolicyOperation
s.- 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.
-