Class AccessCheckResponse
- java.lang.Object
-
- com.identityworksllc.iiq.common.access.AccessCheckResponse
-
- All Implemented Interfaces:
Mappable
,BiConsumer<Boolean,String>
,Consumer<Boolean>
,sailpoint.api.MessageAccumulator
public class AccessCheckResponse extends Object implements Mappable, Consumer<Boolean>, BiConsumer<Boolean,String>, sailpoint.api.MessageAccumulator
The output ofAccessCheck.accessCheck(AccessCheckInput)
, containing the results of the access check (allowed or not) and some metadata.This object can be safely serialized to JSON.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.identityworksllc.iiq.common.Mappable
Mappable.FilterMixin
-
-
Constructor Summary
Constructors Constructor Description AccessCheckResponse()
Basic constructor used by actual users of this classAccessCheckResponse(boolean allowed, List<StampedMessage> messages, long timestamp)
Jackson-specific constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(Boolean status)
A functional interface used to deny access to this thing, if your code happens to be called from a strange context.void
accept(Boolean status, String message)
A functional interface used to deny access to this thing, with a messagevoid
addMessage(String message)
Adds a message to the collectionvoid
addMessage(sailpoint.tools.Message message)
Adds a message to the collectionstatic AccessCheckResponse
decode(String input)
Decodes an AccessCheckResponse from the given String, which should be a JSON formatted value.static AccessCheckResponse
decode(Map<String,Object> input)
Decodes an AccessCheckResponse from the given Map, which may have been generated using this class’sMappable.toMap()
.void
deny()
Denies access to the thing, setting the allowed flag to falsevoid
denyMessage(String reason)
Denies access to the thing, additionally logging a message indicating the denial reasonList<StampedMessage>
getMessages()
Gets the stored messageslong
getTimestamp()
Gets the timestampboolean
isAllowed()
Returns true if the access was allowedvoid
merge(AccessCheckResponse other)
Merges this response with another response.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.function.BiConsumer
andThen
-
Methods inherited from interface com.identityworksllc.iiq.common.Mappable
toMap, toMapFieldExclusions
-
-
-
-
Constructor Detail
-
AccessCheckResponse
public AccessCheckResponse()
Basic constructor used by actual users of this class
-
AccessCheckResponse
public AccessCheckResponse(boolean allowed, List<StampedMessage> messages, long timestamp)
Jackson-specific constructor.Don’t use this one unless you’re a JSON library.
- Parameters:
allowed
- The value of the allowed flagmessages
- The messages (possibly null) to add to a new empty listtimestamp
- The timestamp from the JSON
-
-
Method Detail
-
decode
public static AccessCheckResponse decode(String input) throws IOException
Decodes an AccessCheckResponse from the given String, which should be a JSON formatted value.- Parameters:
input
- The input JSON- Returns:
- The decoded AccessCheckResponse
- Throws:
IOException
- if JSON decoding fails
-
decode
public static AccessCheckResponse decode(Map<String,Object> input)
Decodes an AccessCheckResponse from the given Map, which may have been generated using this class’sMappable.toMap()
.The Map may contain a long ‘timestamp’, a set of ‘messages’, and an ‘allowed’ boolean.
- Parameters:
input
- The Map input- Returns:
- The decoded AccessCheckResponse
-
accept
public void accept(Boolean status)
A functional interface used to deny access to this thing, if your code happens to be called from a strange context.
-
accept
public void accept(Boolean status, String message)
A functional interface used to deny access to this thing, with a message- Specified by:
accept
in interfaceBiConsumer<Boolean,String>
- Parameters:
status
- True if access is allowed, false otherwisemessage
- A ‘deny’ message to be used in the deny case
-
addMessage
public void addMessage(String message)
Adds a message to the collection- Parameters:
message
- The message to add
-
addMessage
public void addMessage(sailpoint.tools.Message message)
Adds a message to the collection- Specified by:
addMessage
in interfacesailpoint.api.MessageAccumulator
- Parameters:
message
- The message to add
-
deny
public void deny()
Denies access to the thing, setting the allowed flag to false
-
denyMessage
public void denyMessage(String reason)
Denies access to the thing, additionally logging a message indicating the denial reason- Parameters:
reason
- the denial reason
-
getMessages
public List<StampedMessage> getMessages()
Gets the stored messages- Returns:
- The stored messages
-
getTimestamp
public long getTimestamp()
Gets the timestamp- Returns:
- The timestamp
-
isAllowed
public boolean isAllowed()
Returns true if the access was allowed- Returns:
- True if access was allowed
-
merge
public void merge(AccessCheckResponse other)
Merges this response with another response.If either response indicates that access is not allowed, then it will be set to false in this object. Also, messages will be merged.
- Parameters:
other
- The other object to merge
-
-