public class IPv4Condition extends EntitlementConditionAdaptor
EntitlementCondition
that can be used to enable/disable an authorization policy
based on the IP address and DNS name of the originating client requesting access to a resource.Constructor and Description |
---|
IPv4Condition()
Constructs a new IPv4Condition instance.
|
IPv4Condition(String startIp,
String endIp,
List<String> ipRange,
List<String> dnsName)
JSON deserialization constructor used to ensure fields are set in an order
that allows inter-field validation to pass.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Returns
true if the passed in object is equal to this object |
ConditionDecision |
evaluate(String realm,
Subject subject,
String resourceName,
Map<String,Set<String>> env)
Returns condition decision.
|
List<String> |
getDnsName() |
String |
getEndIp() |
List<String> |
getIpRange()
Deprecated.
|
String |
getRequestIp(Map env)
Helper method to extract
REQUEST_IP . |
String |
getSessionIp(Subject subject)
Helper method to retrieve IP from subject's
SSOToken . |
String |
getStartIp() |
String |
getState()
Returns state of the object encoded as a JSON string.
|
int |
hashCode()
Returns hash code of the object.
|
void |
setDnsName(List<String> dnsName) |
void |
setIpRange(List<String> ipRanges)
Deprecated.
|
void |
setStartIpAndEndIp(String startIp,
String endIp) |
void |
setState(String state)
Sets state of this object from a JSON string.
|
protected Long |
stringToIp(String ip)
Factory method for constructing an IP value from its String representation.
|
String |
toString() |
void |
validate()
Checks that this condition is configured correctly.
|
getDisplayType, init, setDisplayType, setState, toJSONObject
protected final Debug debug
public IPv4Condition()
public IPv4Condition(String startIp, String endIp, List<String> ipRange, List<String> dnsName) throws EntitlementException
EntitlementException
- If any of the provided properties fail validationprotected Long stringToIp(String ip) throws EntitlementException
ip
- A String representation of an IP value.EntitlementException
- If argument is not a string representing an IP value understood by this object.public void setState(String state)
state
- State of the object encoded as a JSON stringpublic String getStartIp()
public String getEndIp()
public void setStartIpAndEndIp(String startIp, String endIp) throws EntitlementException
EntitlementException
public void setDnsName(List<String> dnsName) throws EntitlementException
EntitlementException
@Deprecated public List<String> getIpRange()
@Deprecated public void setIpRange(List<String> ipRanges) throws EntitlementException
EntitlementException
public String getState()
public void validate() throws EntitlementException
EntitlementCondition
EntitlementException
if not with an
informative message to display to the user creating/updating the policy.EntitlementException
- if the configuration state is not valid.public ConditionDecision evaluate(String realm, Subject subject, String resourceName, Map<String,Set<String>> env) throws EntitlementException
realm
- Realm Name.subject
- Subject who is under evaluation.resourceName
- Resource name.env
- Environment parameters.EntitlementException
- if cannot get condition decision.public String getRequestIp(Map env)
REQUEST_IP
.env
- The map containing environment description. Note that the type of the value corresponding to
REQUEST_IP
parameter differs depending upon invocation path. It will be a String
when
invoked by the agents, but it will be a Set<String>
when invoked via the DecisionResource
(GET ws/1/entitlement/entitlements).public String getSessionIp(Subject subject) throws EntitlementException
SSOToken
.subject
- Subject who is under evaluation.SSOToken
or null if no SSOToken is found.EntitlementException
- If any exception occurs when accessing the subject's SSOToken
.public boolean equals(Object obj)
EntitlementConditionAdaptor
true
if the passed in object is equal to this objectequals
in class EntitlementConditionAdaptor
obj
- object to check for equalitytrue
if the passed in object is equal to this objectpublic int hashCode()
EntitlementConditionAdaptor
hashCode
in class EntitlementConditionAdaptor
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.