public class TargetMatch extends Object
Modifier and Type | Field and Description |
---|---|
static int |
ACTION
An integer value indicating that this class represents an ActionMatch
|
static int |
ENVIRONMENT
An integer value indicating that this class represents an EnvironmentMatch
|
static String[] |
NAMES
Mapping from the 4 match types to their string representations
|
static int |
RESOURCE
An integer value indicating that this class represents a ResourceMatch
|
static int |
SUBJECT
An integer value indicating that this class represents a SubjectMatch
|
Constructor and Description |
---|
TargetMatch(Function function,
Evaluatable eval,
AttributeValue attrValue)
Constructor that creates a
TargetMatch from components. |
TargetMatch(int type,
Function function,
Evaluatable eval,
AttributeValue attrValue)
Constructor that creates a
TargetMatch from components. |
Modifier and Type | Method and Description |
---|---|
void |
encode(StringBuilder builder)
Encodes this
TargetMatch into its XML form and writes this out to the provided
StringBuilder |
static TargetMatch |
getInstance(Node root,
int matchType,
PolicyMetaData metaData)
Creates a
TargetMatch by parsing a node, using the input prefix to determine
whether this is a SubjectMatch, ResourceMatch, or ActionMatch. |
static TargetMatch |
getInstance(Node root,
PolicyMetaData metaData) |
static TargetMatch |
getInstance(Node root,
String prefix,
String xpathVersion)
Deprecated.
As of 2.0 you should avoid using this method and should instead use the version
that takes a
PolicyMetaData instance. This method will only work for
XACML 1.x policies. |
Evaluatable |
getMatchEvaluatable()
Returns the
AttributeDesignator or AttributeSelector used by the
matching function. |
Function |
getMatchFunction()
Returns the
Function used to do the matching. |
AttributeValue |
getMatchValue()
Returns the
AttributeValue used by the matching function. |
int |
getType()
Returns the type of this
TargetMatch , either SUBJECT ,
RESOURCE , ACTION , or ENVIRONMENT . |
MatchResult |
match(EvaluationCtx context)
Determines whether this
TargetMatch matches the input request (whether it is
applicable) |
public static final int SUBJECT
public static final int RESOURCE
public static final int ACTION
public static final int ENVIRONMENT
public static final String[] NAMES
public TargetMatch(int type, Function function, Evaluatable eval, AttributeValue attrValue) throws IllegalArgumentException
TargetMatch
from components.type
- an integer indicating whether this class represents a SubjectMatch,
ResourceMatch, or ActionMatchfunction
- the Function
that represents the MatchIdeval
- the AttributeDesignator
or AttributeSelector
to be used
to select attributes from the request contextattrValue
- the AttributeValue
to compare againstIllegalArgumentException
- if the input type isn't a valid valuepublic TargetMatch(Function function, Evaluatable eval, AttributeValue attrValue) throws IllegalArgumentException
TargetMatch
from components.function
- the Function
that represents the MatchIdeval
- the AttributeDesignator
or AttributeSelector
to be used
to select attributes from the request contextattrValue
- the AttributeValue
to compare againstIllegalArgumentException
- if the input type isn't a valid valuepublic static TargetMatch getInstance(Node root, String prefix, String xpathVersion) throws ParsingException, IllegalArgumentException
PolicyMetaData
instance. This method will only work for
XACML 1.x policies.TargetMatch
by parsing a node, using the input prefix to determine
whether this is a SubjectMatch, ResourceMatch, or ActionMatch.root
- the node to parse for the TargetMatch
prefix
- a String indicating what type of TargetMatch
to instantiate
(Subject, Resource, or Action)xpathVersion
- the XPath version to use in any selectors, or null if this is unspecified
(ie, not supplied in the defaults section of the policy)TargetMatch
constructed by parsingParsingException
- if there was an error during parsingIllegalArgumentException
- if the input prefix isn't a valid valuepublic static TargetMatch getInstance(Node root, PolicyMetaData metaData) throws ParsingException
ParsingException
public static TargetMatch getInstance(Node root, int matchType, PolicyMetaData metaData) throws ParsingException
TargetMatch
by parsing a node, using the input prefix to determine
whether this is a SubjectMatch, ResourceMatch, or ActionMatch.root
- the node to parse for the TargetMatch
matchType
- the type of TargetMatch
as specified by the SUBJECT, RESOURCE,
ACTION, or ENVIRONMENT fieldsmetaData
- the policy's meta-dataTargetMatch
constructed by parsingParsingException
- if there was an error during parsingpublic int getType()
TargetMatch
, either SUBJECT
,
RESOURCE
, ACTION
, or ENVIRONMENT
.public Function getMatchFunction()
Function
used to do the matching.public AttributeValue getMatchValue()
AttributeValue
used by the matching function.AttributeValue
for the matchpublic Evaluatable getMatchEvaluatable()
AttributeDesignator
or AttributeSelector
used by the
matching function.public MatchResult match(EvaluationCtx context)
TargetMatch
matches the input request (whether it is
applicable)context
- the representation of the requestpublic void encode(StringBuilder builder)
TargetMatch
into its XML form and writes this out to the provided
StringBuilder
builder
- string stream into which the XML-encoded data is writtenCopyright © 2021 WSO2. All rights reserved.