Class TrustChainConstraints
- java.lang.Object
-
- com.nimbusds.openid.connect.sdk.federation.trust.constraints.TrustChainConstraints
-
- All Implemented Interfaces:
net.minidev.json.JSONAware
@Immutable public final class TrustChainConstraints extends Object implements net.minidev.json.JSONAware
Trust chain constraints.Example JSON object:
{ "max_path_length" : 2, "naming_constraints" : { "permitted" : [ "https://example.com" ], "excluded" : [ "https://east.example.com" ] } }
Related specifications:
- OpenID Connect Federation 1.0, section 7.2.
- RFC 5280, section 4.2.1.10.
-
-
Field Summary
Fields Modifier and Type Field Description static TrustChainConstraints
NO_CONSTRAINTS
No constraint instance.
-
Constructor Summary
Constructors Constructor Description TrustChainConstraints()
Creates a new no constraints instance.TrustChainConstraints(int maxPathLength)
Creates a new trust chain constraints instance.TrustChainConstraints(int maxPathLength, List<EntityIDConstraint> permittedEntities, List<EntityIDConstraint> excludedEntities)
Creates a new trust chain constraints instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
List<EntityIDConstraint>
getExcludedEntities()
Returns the excluded entities.int
getMaxPathLength()
Returns the maximum number of entities between this and the last one in the chain.List<EntityIDConstraint>
getPermittedEntities()
Returns the permitted entities.int
hashCode()
boolean
isPermitted(int numIntermediatesInPath)
Checks if the given number of intermediates is permitted.boolean
isPermitted(int numIntermediatesInPath, EntityID entityID)
Checks if the entity ID with the given number of intermediates is permitted.boolean
isPermitted(EntityID entityID)
Checks if the entity ID is permitted.static TrustChainConstraints
parse(net.minidev.json.JSONObject jsonObject)
Parses a trust chain constraints instance from the specified JSON object.net.minidev.json.JSONObject
toJSONObject()
Returns a JSON object representation of this trust chain constraints.String
toJSONString()
-
-
-
Field Detail
-
NO_CONSTRAINTS
public static final TrustChainConstraints NO_CONSTRAINTS
No constraint instance.
-
-
Constructor Detail
-
TrustChainConstraints
public TrustChainConstraints()
Creates a new no constraints instance.
-
TrustChainConstraints
public TrustChainConstraints(int maxPathLength)
Creates a new trust chain constraints instance.- Parameters:
maxPathLength
- The maximum number of entities between this and the last one in the chain, -1 if not specified.
-
TrustChainConstraints
public TrustChainConstraints(int maxPathLength, List<EntityIDConstraint> permittedEntities, List<EntityIDConstraint> excludedEntities)
Creates a new trust chain constraints instance.- Parameters:
maxPathLength
- The maximum number of entities between this and the last one in the chain, -1 if not specified.permittedEntities
- The permitted entities,null
if not specified.excludedEntities
- The excluded entities,null
if not specified.
-
-
Method Detail
-
isPermitted
public boolean isPermitted(int numIntermediatesInPath)
Checks if the given number of intermediates is permitted.- Parameters:
numIntermediatesInPath
- The number of intermediate entities between the entity specifying the constraints and the specified entity. Must be zero or greater.- Returns:
true
if permitted, elsefalse
.
-
isPermitted
public boolean isPermitted(EntityID entityID)
Checks if the entity ID is permitted.- Parameters:
entityID
- The entity ID. Must not benull
.- Returns:
true
if permitted, elsefalse
.
-
isPermitted
public boolean isPermitted(int numIntermediatesInPath, EntityID entityID)
Checks if the entity ID with the given number of intermediates is permitted.- Parameters:
numIntermediatesInPath
- The number of intermediate entities between the entity specifying the constraints and the specified entity. Must be zero or greater.entityID
- The entity ID. Must not benull
.- Returns:
true
if permitted, elsefalse
.
-
getMaxPathLength
public int getMaxPathLength()
Returns the maximum number of entities between this and the last one in the chain.- Returns:
- The maximum number of entities between this and the last one in the chain, -1 if not specified.
-
getPermittedEntities
public List<EntityIDConstraint> getPermittedEntities()
Returns the permitted entities.- Returns:
- The permitted entities, empty list if not specified.
-
getExcludedEntities
public List<EntityIDConstraint> getExcludedEntities()
Returns the excluded entities.- Returns:
- The excluded entities, empty list if not specified.
-
toJSONObject
public net.minidev.json.JSONObject toJSONObject()
Returns a JSON object representation of this trust chain constraints.- Returns:
- The JSON object.
-
toJSONString
public String toJSONString()
- Specified by:
toJSONString
in interfacenet.minidev.json.JSONAware
-
parse
public static TrustChainConstraints parse(net.minidev.json.JSONObject jsonObject) throws ParseException
Parses a trust chain constraints instance from the specified JSON object.- Parameters:
jsonObject
- The JSON object. Must not benull
.- Returns:
- The trust chain constraints.
- Throws:
ParseException
- If parsing failed.
-
-