|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.caucho.server.security.AbstractConstraint
com.caucho.server.security.IPConstraint
public class IPConstraint
Allow or deny requests based on the ip address of the client.
<security-constraint> <ip-constraint> <allow>192.168.17.0/24</allow> </ip-constraint> <web-resource-collection> <url-pattern>/admin/*</url-pattern> </web-resource-collection> </security-constraint>
<security-constraint> <ip-constraint> <deny>205.11.12.3</deny> <deny>213.43.62.45</deny> <deny>123.4.45.6</deny> <deny>233.15.25.35</deny> <deny>233.14.87.12</deny> </ip-constraint> <web-resource-collection> <url-pattern>/*</url-pattern> </web-resource-collection> </security-constraint>
Constructor Summary | |
---|---|
IPConstraint()
|
Method Summary | |
---|---|
void |
addAllow(java.lang.String network)
Add an ip network to allow. |
void |
addDeny(java.lang.String network)
Add an ip network to deny. |
void |
addText(java.lang.String network)
backwards compatibility, same as addAllow() |
int |
getCacheSize()
Size of the cache used to hold whether or not to allow a certain IP address. |
int |
getErrorCode()
The error code to send with response.sendError, default is 403. |
java.lang.String |
getErrorMessage()
The error message to send with response.sendError, default is "Forbidden IP Address" |
void |
init()
|
AuthorizationResult |
isAuthorized(HttpServletRequest request,
HttpServletResponse response,
ServletContext application)
Returns true if the user is authorized for the resource. |
void |
setCacheSize(int cacheSize)
Size of the cache used to hold whether or not to allow a certain IP address, default is 256. |
void |
setErrorCode(int errorCode)
The error code to send with response.sendError, default is 403. |
void |
setErrorMessage(java.lang.String errorMessage)
The error message to send with response.sendError, default is "Forbidden IP Address" |
Methods inherited from class com.caucho.server.security.AbstractConstraint |
---|
isPrivateCache, needsAuthentication, toArray |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IPConstraint()
Method Detail |
---|
public void setErrorCode(int errorCode)
public int getErrorCode()
public void setErrorMessage(java.lang.String errorMessage)
public java.lang.String getErrorMessage()
public void setCacheSize(int cacheSize)
public int getCacheSize()
public void addAllow(java.lang.String network) throws java.net.UnknownHostException
java.net.UnknownHostException
public void addDeny(java.lang.String network) throws java.net.UnknownHostException
java.net.UnknownHostException
public void addText(java.lang.String network) throws java.net.UnknownHostException
java.net.UnknownHostException
@PostConstruct public void init() throws ConfigException
ConfigException
public AuthorizationResult isAuthorized(HttpServletRequest request, HttpServletResponse response, ServletContext application) throws ServletException, java.io.IOException
isAuthorized
in class AbstractConstraint
request
- the servlet requestresponse
- the servlet response
ServletException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |