public class Context extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CONTEXT_CONFIG |
static String |
CONTEXT_CONFIG_DATA_DRIVEN_NODES |
static String |
CONTEXT_CONFIG_DESC |
static String |
CONTEXT_CONFIG_EXC_REGEXES |
static String |
CONTEXT_CONFIG_INC_REGEXES |
static String |
CONTEXT_CONFIG_INSCOPE |
static String |
CONTEXT_CONFIG_NAME |
static String |
CONTEXT_CONFIG_POSTPARSER |
static String |
CONTEXT_CONFIG_POSTPARSER_CLASS |
static String |
CONTEXT_CONFIG_POSTPARSER_CONFIG |
static String |
CONTEXT_CONFIG_TECH |
static String |
CONTEXT_CONFIG_TECH_EXCLUDE |
static String |
CONTEXT_CONFIG_TECH_INCLUDE |
static String |
CONTEXT_CONFIG_URLPARSER |
static String |
CONTEXT_CONFIG_URLPARSER_CLASS |
static String |
CONTEXT_CONFIG_URLPARSER_CONFIG |
Modifier and Type | Method and Description |
---|---|
void |
addCustomPage(CustomPage customPage)
Adds a custom page.
|
void |
addDataDrivenNodes(StructuralNodeModifier ddn) |
void |
addExcludeFromContextRegex(String excludeRegex) |
void |
addIncludeInContextRegex(String includeRegex) |
Context |
duplicate()
Creates a copy of the Context.
|
boolean |
equals(Object obj) |
void |
excludeFromContext(SiteNode sn,
boolean recurse) |
void |
excludeFromContext(StructuralNode sn,
boolean recurse) |
AuthenticationMethod |
getAuthenticationMethod()
Gets the authentication method corresponding to this context.
|
AuthorizationDetectionMethod |
getAuthorizationDetectionMethod()
Gets the authorization detection method corresponding to this context.
|
List<CustomPage> |
getCustomPages()
Gets an unmodifiable view of the list of custom pages.
|
List<StructuralNodeModifier> |
getDataDrivenNodes() |
String |
getDefaultDDNName() |
String |
getDescription() |
List<String> |
getExcludeFromContextRegexs() |
int |
getId()
Returns the ID of the
Context |
List<String> |
getIncludeInContextRegexs() |
int |
getIndex()
Deprecated.
(2.9.0) Use
getId() instead. |
String |
getName()
Gets the name of the context.
|
List<SiteNode> |
getNodesInContextFromSiteTree()
Gets the nodes from the site tree which are "In Scope".
|
ParameterParser |
getPostParamParser() |
SessionManagementMethod |
getSessionManagementMethod()
Gets the session management method corresponding to this context.
|
TechSet |
getTechSet() |
List<SiteNode> |
getTopNodesInContextFromSiteTree()
Gets the nodes from the site tree which are "In Scope".
|
ParameterParser |
getUrlParamParser() |
boolean |
hasCustomPageOfType(CustomPage.Type cpType)
Returns
true if the Context has Custom Page definitions of a specific CustomPage.Type . |
boolean |
hasCustomPages()
Returns
true if the Context has Custom Pages. |
int |
hashCode() |
boolean |
hasNodesInContextFromSiteTree()
Tells whether or not there's at least one node from the sites tree in context.
|
boolean |
isCustomPage(HttpMessage msg,
CustomPage.Type cpType)
Determines if a
HttpMessage is a Custom Page of a particular CustomPage.Type . |
boolean |
isCustomPageWithFallback(HttpMessage msg,
CustomPage.Type cpType)
Determines if a
HttpMessage is a Custom Page of a particular CustomPage.Type . |
boolean |
isExcluded(SiteNode sn) |
boolean |
isExcluded(String url) |
boolean |
isExcludedFromScope(SiteNode sn) |
boolean |
isIncluded(SiteNode sn) |
boolean |
isIncluded(String url) |
boolean |
isIncludedInScope(SiteNode sn) |
boolean |
isInContext(HistoryReference href) |
boolean |
isInContext(SiteNode sn) |
boolean |
isInContext(String url) |
boolean |
isInScope() |
void |
removeAllCustomPages()
Removes all the custom pages.
|
boolean |
removeCustomPage(CustomPage customPage)
Removes a custom page.
|
void |
restructureSiteTree() |
void |
save() |
void |
setAuthenticationMethod(AuthenticationMethod authenticationMethod)
Sets the authentication method corresponding to this context.
|
void |
setAuthorizationDetectionMethod(AuthorizationDetectionMethod authorizationDetectionMethod)
Sets the authorization detection method corresponding to this context.
|
void |
setCustomPages(List<CustomPage> customPages)
Sets a new list of custom pages for this context.
|
void |
setDataDrivenNodes(List<StructuralNodeModifier> dataDrivenNodes) |
void |
setDescription(String description) |
void |
setExcludeFromContextRegexs(List<String> excludeRegexs)
Sets the regular expressions used to exclude a URL from the context.
|
void |
setIncludeInContextRegexs(List<String> includeRegexs)
Sets the regular expressions used to include a URL in context.
|
void |
setInScope(boolean inScope) |
void |
setName(String name)
Sets the name of the context.
|
void |
setPostParamParser(ParameterParser postParamParser) |
void |
setSessionManagementMethod(SessionManagementMethod sessionManagementMethod)
Sets the session management method corresponding to this context.
|
void |
setTechSet(TechSet techSet) |
void |
setUrlParamParser(ParameterParser paramParser) |
public static final String CONTEXT_CONFIG
public static final String CONTEXT_CONFIG_NAME
public static final String CONTEXT_CONFIG_DESC
public static final String CONTEXT_CONFIG_INSCOPE
public static final String CONTEXT_CONFIG_INC_REGEXES
public static final String CONTEXT_CONFIG_EXC_REGEXES
public static final String CONTEXT_CONFIG_TECH
public static final String CONTEXT_CONFIG_TECH_INCLUDE
public static final String CONTEXT_CONFIG_TECH_EXCLUDE
public static final String CONTEXT_CONFIG_URLPARSER
public static final String CONTEXT_CONFIG_URLPARSER_CLASS
public static final String CONTEXT_CONFIG_URLPARSER_CONFIG
public static final String CONTEXT_CONFIG_POSTPARSER
public static final String CONTEXT_CONFIG_POSTPARSER_CLASS
public static final String CONTEXT_CONFIG_POSTPARSER_CONFIG
public static final String CONTEXT_CONFIG_DATA_DRIVEN_NODES
public Context(Session session, int id)
public boolean isIncludedInScope(SiteNode sn)
public boolean isIncluded(SiteNode sn)
public boolean isIncluded(String url)
public boolean isExcludedFromScope(SiteNode sn)
public boolean isExcluded(SiteNode sn)
public boolean isExcluded(String url)
public boolean isInContext(HistoryReference href)
public boolean isInContext(SiteNode sn)
public boolean isInContext(String url)
public List<SiteNode> getNodesInContextFromSiteTree()
hasNodesInContextFromSiteTree()
public boolean hasNodesInContextFromSiteTree()
true
if the context has at least one node from the sites tree in context,
false
otherwisegetNodesInContextFromSiteTree()
public List<SiteNode> getTopNodesInContextFromSiteTree()
public void setIncludeInContextRegexs(List<String> includeRegexs)
includeRegexs
- the regular expressionsIllegalArgumentException
- if one of the regular expressions is null
or empty.PatternSyntaxException
- if one of the regular expressions is invalid.public void excludeFromContext(SiteNode sn, boolean recurse) throws Exception
Exception
public void excludeFromContext(StructuralNode sn, boolean recurse) throws Exception
Exception
public void addIncludeInContextRegex(String includeRegex)
public void setExcludeFromContextRegexs(List<String> excludeRegexs)
excludeRegexs
- the regular expressionsIllegalArgumentException
- if one of the regular expressions is null
.PatternSyntaxException
- if one of the regular expressions is invalid.public void addExcludeFromContextRegex(String excludeRegex)
public void save()
public TechSet getTechSet()
public void setTechSet(TechSet techSet)
public String getName()
null
(since 2.6.0).public void setName(String name)
name
- the new name of the contextIllegalContextNameException
- (since 2.6.0) if the given name is null
or empty.public String getDescription()
public void setDescription(String description)
@Deprecated public int getIndex()
getId()
instead.Context
public int getId()
Context
public boolean isInScope()
public void setInScope(boolean inScope)
public AuthenticationMethod getAuthenticationMethod()
public void setAuthenticationMethod(AuthenticationMethod authenticationMethod)
authenticationMethod
- the new authentication methodpublic SessionManagementMethod getSessionManagementMethod()
public void setSessionManagementMethod(SessionManagementMethod sessionManagementMethod)
sessionManagementMethod
- the new session management methodpublic AuthorizationDetectionMethod getAuthorizationDetectionMethod()
public void setAuthorizationDetectionMethod(AuthorizationDetectionMethod authorizationDetectionMethod)
authorizationDetectionMethod
- the new authorization detectionmethodpublic ParameterParser getUrlParamParser()
public void setUrlParamParser(ParameterParser paramParser)
public ParameterParser getPostParamParser()
public void setPostParamParser(ParameterParser postParamParser)
public void restructureSiteTree()
public List<StructuralNodeModifier> getDataDrivenNodes()
public void setDataDrivenNodes(List<StructuralNodeModifier> dataDrivenNodes)
public void addDataDrivenNodes(StructuralNodeModifier ddn)
public String getDefaultDDNName()
public List<CustomPage> getCustomPages()
public boolean hasCustomPages()
true
if the Context
has Custom Pages.true
if this context has Custom Pages, false
otherwise.public boolean hasCustomPageOfType(CustomPage.Type cpType)
true
if the Context
has Custom Page definitions of a specific CustomPage.Type
.true
if this context has Custom Pages, false
otherwise.public void setCustomPages(List<CustomPage> customPages)
customPages
- the list of custom pagespublic void addCustomPage(CustomPage customPage)
customPage
- the custom page being addedpublic boolean removeCustomPage(CustomPage customPage)
customPage
- the defaultCustomPage to be removedpublic void removeAllCustomPages()
public boolean isCustomPage(HttpMessage msg, CustomPage.Type cpType)
HttpMessage
is a Custom Page of a particular CustomPage.Type
.msg
- the HTTP message to be evaluatedcpType
- the CustomPage.Type of the Custom Pages against which the HTTP message should
be evaluatedtrue
if the HTTP message is a Custom Page of the type in question, false
otherwiseisCustomPageWithFallback(HttpMessage,
org.zaproxy.zap.extension.custompages.CustomPage.Type)
public boolean isCustomPageWithFallback(HttpMessage msg, CustomPage.Type cpType)
HttpMessage
is a Custom Page of a particular CustomPage.Type
.
Falling back to check the message's status code.msg
- the HTTP message to be evaluatedcpType
- the CustomPage.Type of the Custom Pages against which the HTTP message should
be evaluatedtrue
if the HTTP message is a Custom Page of the type in question or the
response has a relevant status code (500, 404, etc), false
otherwiseisCustomPage(HttpMessage, org.zaproxy.zap.extension.custompages.CustomPage.Type)
public Context duplicate()