Package sailpoint.server
Interface IdnRuleUtil
public interface IdnRuleUtil
Utility class containing methods you can use within a rule to perform common tasks.
Methods that target a specific source identify that source by its id. The account lookup methods still resolve a source name that is passed in place of an id, so existing rules keep working, but rules should pass the source id. The methods that read entitlement data, source configuration or searchable account attributes require the source id.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic enumThe properties of the managed attribute model thatfindManagedAttributes(java.lang.String, java.lang.String, sailpoint.server.IdnRuleUtil.ManagedAttributeProperty, sailpoint.server.IdnRuleUtil.FindOperation, java.lang.String, java.lang.String, sailpoint.server.IdnRuleUtil.ManagedAttributeProperty)can query and sort on. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringOperation that matches values equal to the supplied value.static final StringOperation that matches values beginning with the supplied value.static final StringThe Entitlement managed attribute type, for use as the entitlementType argument offindManagedAttributes(java.lang.String, java.lang.String, sailpoint.server.IdnRuleUtil.ManagedAttributeProperty, sailpoint.server.IdnRuleUtil.FindOperation, java.lang.String, java.lang.String, sailpoint.server.IdnRuleUtil.ManagedAttributeProperty).static final StringThe Permission managed attribute type, for use as the entitlementType argument offindManagedAttributes(java.lang.String, java.lang.String, sailpoint.server.IdnRuleUtil.ManagedAttributeProperty, sailpoint.server.IdnRuleUtil.FindOperation, java.lang.String, java.lang.String, sailpoint.server.IdnRuleUtil.ManagedAttributeProperty). -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccountExistsByDisplayName(String sourceId, String displayName) Determines if an account currently exists on a source using the display name.booleanaccountExistsByNativeIdentity(String sourceId, String nativeIdentity) Determines if an account currently exists on a source using the native identity.Return the given object as a List.intattrSearchCountAccounts(List<String> sourceIds, String attributeName, String operation, List<String> values) Count the accounts that match the searchable attribute and value.attrSearchGetIdentityName(List<String> sourceIds, String attributeName, String operation, List<String> values) Get the identity name for the account matching the specified criteria.intcountAccounts(String sourceId) Counts the number of accounts on a source.intcountIdentitiesBySearchableIdentityAttribute(String attributeName, String operation, String value) Count and return the number of users that match the incoming attributeName, operation and value.dateToString(Date src, String format) Format a Date as a String using the JVM's default time zone.dateToString(Date src, String format, TimeZone tz) Format a Date as a String in the supplied time zone.findAccountsByAttribute(String sourceId, String identityName, String attributeName, Object attributeValue) Method that will return a list of accounts for the given Identity that matches the attributeName and values passed to the method.findIdentitiesBySearchableIdentityAttribute(String attributeName, String operation, String value, String sortAttribute) Find and return the users that match the incoming attributeName, operation, value ordered by the specified sortAttributefindManagedAttributes(String sourceId, String attributeName, IdnRuleUtil.ManagedAttributeProperty property, IdnRuleUtil.FindOperation operation, String valueToMatch, String entitlementType, IdnRuleUtil.ManagedAttributeProperty sortAttribute) Find the entitlements on a source that match the supplied criteria and return them as ManagedAttributeDetails models.getAccountAttribute(String sourceId, String nativeIdentity, String attribute) Gets the String value of an attribute from an account on a source.getAccountAttribute(Account account, String attribute) Gets the String value of an attribute from an account.booleangetAccountAttributeBool(String sourceId, String nativeIdentity, String attribute) Gets the boolean value of an attribute from an account on a source.booleangetAccountAttributeBool(Account account, String attribute) Gets the boolean value of an attribute from an account.intgetAccountAttributeInt(String sourceId, String nativeIdentity, String attribute) Gets the int value of an attribute from an account on a source.intgetAccountAttributeInt(Account account, String attribute) Gets the int value of an attribute from an account.getAccountByDisplayName(String sourceId, String displayName) Gets an account on a source using the display name.getAccountByNativeIdentity(String sourceId, String nativeIdentity) Gets an account on a source using the native identity.getAllAccounts(String sourceId, String identityName) Given the id of the source and the identity name return the list of Account objects found for the identity.getFirstAccount(String sourceId, String identityName) Get the first account found for the source and identityName.getFirstAccountNativeIdentity(String sourceId, String identityName) Get the first account for the source and identityName and return the first account's native Identity.getFirstAccountNativeIdentityByAttribute(String sourceId, String identityName, String attributeName, Object attributeValue) Method that will find the first nativeIdentity based on the attributeName and attributeValue being passed in.Fetch an identity by the internal id.getManagedAttributeDescription(String sourceId, String name, String value, ManagedAttribute.Type type) Finds ManagedAttribute description by provided sourceId/name/value/type.getManagedAttributeDetails(String sourceId, String name, String value, ManagedAttribute.Type type) Finds ManagedAttribute by sourceId/name/value/type and returns its details in ManagedAttributeDetails model.getRawAccountAttribute(String sourceId, String nativeIdentity, String attribute) Gets the value of an attribute from an account on a source.getRawAccountAttribute(Account account, String attribute) Gets the value of an attribute from an account.getSourceAttributeBySourceId(String sourceId, String attributeName) Get a single Source string attribute from a source using the source idgetSourceAttributeBySourceName(String sourceName, String attributeName) Get a single Source string attribute from a source using the source namebooleanisUniqueAccountId(String identityNameOrId, String applicationNameOrId, String accountId) A method that will call getObject() on the connector for the Account type and test if an account with the given accountId exists.booleanisUniqueLDAPValue(String identityNameOrId, String applicationNameOrId, String attributeName, String attributeValue) A method that can be used to call LDAP type connectors to look for unique values.booleannullSafeCaseInsensitiveEq(String o1, String o2) Perform a null-safe, case-insensitive equality comparison between two Strings.<T extends Comparable>
intnullSafeCompareTo(T o1, T o2) Compare two objects that may be null.booleannullSafeEq(Object o1, Object o2) Perform a null-safe equality comparison between two objects.booleannullSafeEq(Object o1, Object o2, boolean nullsEq) Perform a null-safe equality comparison between two objects, choosing whether two nulls are equal.Convert an object to a String.booleanConvert an object to a boolean.
-
Field Details
-
STARTS_WITH_FILTER
Operation that matches values beginning with the supplied value.- See Also:
-
EQUALS_FILTER
Operation that matches values equal to the supplied value.- See Also:
-
TYPE_PERMISSION
The Permission managed attribute type, for use as the entitlementType argument offindManagedAttributes(java.lang.String, java.lang.String, sailpoint.server.IdnRuleUtil.ManagedAttributeProperty, sailpoint.server.IdnRuleUtil.FindOperation, java.lang.String, java.lang.String, sailpoint.server.IdnRuleUtil.ManagedAttributeProperty).- See Also:
-
TYPE_ENTITLEMENT
The Entitlement managed attribute type, for use as the entitlementType argument offindManagedAttributes(java.lang.String, java.lang.String, sailpoint.server.IdnRuleUtil.ManagedAttributeProperty, sailpoint.server.IdnRuleUtil.FindOperation, java.lang.String, java.lang.String, sailpoint.server.IdnRuleUtil.ManagedAttributeProperty).- See Also:
-
-
Method Details
-
accountExistsByNativeIdentity
boolean accountExistsByNativeIdentity(String sourceId, String nativeIdentity) throws sailpoint.tools.GeneralException Determines if an account currently exists on a source using the native identity.- Parameters:
sourceId- The id of the source.nativeIdentity- The native identity of the account.- Returns:
- True if the account exists, false otherwise.
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
accountExistsByDisplayName
boolean accountExistsByDisplayName(String sourceId, String displayName) throws sailpoint.tools.GeneralException Determines if an account currently exists on a source using the display name.- Parameters:
sourceId- The id of the source.displayName- The display name of the account.- Returns:
- True if the account exists, false otherwise.
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
getAccountByNativeIdentity
Account getAccountByNativeIdentity(String sourceId, String nativeIdentity) throws sailpoint.tools.GeneralException Gets an account on a source using the native identity.- Parameters:
sourceId- The id of the source.nativeIdentity- The native identity of the account.- Returns:
- The Account representing the account or null if not found. If more than one is found then the first Account found is returned.
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
getAccountByDisplayName
Account getAccountByDisplayName(String sourceId, String displayName) throws sailpoint.tools.GeneralException Gets an account on a source using the display name.- Parameters:
sourceId- The id of the source.displayName- The display name of the account.- Returns:
- The Account representing the account or null if not found. If more than one is found then the first Account found is returned.
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
getAllAccounts
List<Account> getAllAccounts(String sourceId, String identityName) throws sailpoint.tools.GeneralException Given the id of the source and the identity name return the list of Account objects found for the identity.- Parameters:
sourceId- The id of the sourceidentityName- The name of the identity- Returns:
- The list of Accounts found for the identity, or null if the identity has no accounts on the source or either parameter is null
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
getFirstAccount
Account getFirstAccount(String sourceId, String identityName) throws sailpoint.tools.GeneralException Get the first account found for the source and identityName. If there is more than one account the first account will be returned.- Parameters:
sourceId- The id of the sourceidentityName- The name of the Identity- Returns:
- The account object
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
getFirstAccountNativeIdentity
String getFirstAccountNativeIdentity(String sourceId, String identityName) throws sailpoint.tools.GeneralException Get the first account for the source and identityName and return the first account's native Identity.- Parameters:
sourceId- The id of the sourceidentityName- The name of the identity- Returns:
- The first link's nativeIdentity
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
getFirstAccountNativeIdentityByAttribute
String getFirstAccountNativeIdentityByAttribute(String sourceId, String identityName, String attributeName, Object attributeValue) throws sailpoint.tools.GeneralException Method that will find the first nativeIdentity based on the attributeName and attributeValue being passed in. This method will iterate over the list of Accounts associated to the Identity for the Source specified.- Parameters:
sourceId- The id of the sourceidentityName- The name of the identity we are usingattributeName- The name of the attribute we are to matchattributeValue- The value of the attribute we are to match- Returns:
- The first non-null AND non-empty nativeIdentity that matches the passed in identity, attributeName and attributeValue. When matching attributeValue if the values are both null they are equal, if the value is an empty string it'll be transformed to a null.
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
findAccountsByAttribute
List<Account> findAccountsByAttribute(String sourceId, String identityName, String attributeName, Object attributeValue) throws sailpoint.tools.GeneralException Method that will return a list of accounts for the given Identity that matches the attributeName and values passed to the method.- Parameters:
sourceId- The id of the sourceidentityName- The name of the identity we are usingattributeName- The name of the attribute we are to matchattributeValue- The value of the attribute we are to match- Returns:
- accounts that match the given identity, source, attribute and value, empty list if no accounts are found.
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
countAccounts
Counts the number of accounts on a source.- Parameters:
sourceId- The id of the source.- Returns:
- The total number of accounts.
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
getRawAccountAttribute
Object getRawAccountAttribute(String sourceId, String nativeIdentity, String attribute) throws sailpoint.tools.GeneralException Gets the value of an attribute from an account on a source.- Parameters:
sourceId- The id of the source.nativeIdentity- The native identity of the account.attribute- The name of the attribute to retrieve.- Returns:
- The attribute value or null if the attribute does not exist.
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
getRawAccountAttribute
Gets the value of an attribute from an account.- Parameters:
account- The account on the source.attribute- The name of the attribute to retrieve.- Returns:
- The attribute value or null if the attribute does not exist.
-
getAccountAttribute
String getAccountAttribute(String sourceId, String nativeIdentity, String attribute) throws sailpoint.tools.GeneralException Gets the String value of an attribute from an account on a source.- Parameters:
sourceId- The id of the source.nativeIdentity- The native identity of the account.attribute- The name of the attribute to retrieve.- Returns:
- The attribute value or null if the attribute does not exist.
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
getAccountAttribute
Gets the String value of an attribute from an account.- Parameters:
account- The account on the source.attribute- The name of the attribute to retrieve.- Returns:
- The attribute value or null if the attribute does not exist.
-
getAccountAttributeBool
boolean getAccountAttributeBool(String sourceId, String nativeIdentity, String attribute) throws sailpoint.tools.GeneralException Gets the boolean value of an attribute from an account on a source.- Parameters:
sourceId- The id of the source.nativeIdentity- The native identity of the account.attribute- The name of the attribute to retrieve.- Returns:
- The attribute value or false if the attribute does not exist.
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
getAccountAttributeBool
Gets the boolean value of an attribute from an account.- Parameters:
account- The account on the source.attribute- The name of the attribute to retrieve.- Returns:
- The attribute value or false if the attribute does not exist.
-
attrSearchCountAccounts
int attrSearchCountAccounts(List<String> sourceIds, String attributeName, String operation, List<String> values) Count the accounts that match the searchable attribute and value.- Parameters:
sourceIds- The list of source ids that represent the sources of the data.attributeName- The name of the searchable account attribute. The name parameter is required.operation- The operation to use when matching, it'll either be Equals or StartsWith.values- The list of values of that searchable attribute to match. The values parameter is required.- Returns:
- The number of accounts that match the parameters provided.
- Throws:
IllegalStateException- wrapping underlying errors- See Also:
-
attrSearchGetIdentityName
String attrSearchGetIdentityName(List<String> sourceIds, String attributeName, String operation, List<String> values) Get the identity name for the account matching the specified criteria.- Parameters:
sourceIds- The list of source ids that represent the sources of the dataattributeName- The name of the searchable account attribute. The name parameter is required.operation- The operation to use when matching, it'll either be Equals or StartsWith.values- The list of values of that searchable attribute to match. The values parameter is required.- Returns:
- The name of the Identity that matched the account that match the parameters provided.
- Throws:
IllegalStateException- wrapping underlying errors- See Also:
-
getAccountAttributeInt
int getAccountAttributeInt(String sourceId, String nativeIdentity, String attribute) throws sailpoint.tools.GeneralException Gets the int value of an attribute from an account on a source.- Parameters:
sourceId- The id of the source.nativeIdentity- The native identity of the account.attribute- The name of the attribute to retrieve.- Returns:
- The attribute value or zero if the attribute does not exist.
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
getAccountAttributeInt
Gets the int value of an attribute from an account.- Parameters:
account- The account on the source.attribute- The name of the attribute to retrieve.- Returns:
- The attribute value or zero if the attribute does not exist.
-
getManagedAttributeDescription
String getManagedAttributeDescription(String sourceId, String name, String value, ManagedAttribute.Type type) throws sailpoint.tools.GeneralException Finds ManagedAttribute description by provided sourceId/name/value/type.- Parameters:
sourceId- The sourceId used to query the ManagedAttribute.name- The name of the attribute used to query the ManagedAttribute.value- The value of the attribute used to query the ManagedAttribute.type- The type of the attribute used to query the ManagedAttribute (see enum ManagedAttribute.Type). Defaults to Entitlement (if null provided).- Returns:
- ManagedAttribute's description if found or else null.
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
getManagedAttributeDetails
ManagedAttributeDetails getManagedAttributeDetails(String sourceId, String name, String value, ManagedAttribute.Type type) throws sailpoint.tools.GeneralException Finds ManagedAttribute by sourceId/name/value/type and returns its details in ManagedAttributeDetails model.- Parameters:
sourceId- The sourceId used to query the ManagedAttribute.name- The name of the attribute used to query the ManagedAttribute.value- The value of the attribute used to query the ManagedAttribute.type- The type of the attribute used to query the ManagedAttribute (see enum ManagedAttribute.Type). Defaults to Entitlement (if null provided).- Returns:
- ManagedAttributeDetails if found or else null.
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
findManagedAttributes
List<ManagedAttributeDetails> findManagedAttributes(String sourceId, String attributeName, IdnRuleUtil.ManagedAttributeProperty property, IdnRuleUtil.FindOperation operation, String valueToMatch, String entitlementType, IdnRuleUtil.ManagedAttributeProperty sortAttribute) throws sailpoint.tools.GeneralException Find the entitlements on a source that match the supplied criteria and return them as ManagedAttributeDetails models.- Parameters:
sourceId- The id of the source to query. This parameter is required.attributeName- The attribute from the account schema the entitlement belongs to, i.e. memberOf. Pass null to match entitlements of any attribute.property- The searchable property to match valueToMatch against. Pass null to match every entitlement on the source.operation- The operation to use when matching the property.valueToMatch- The value the property is matched against.entitlementType- The managed attribute type to query, see TYPE_ENTITLEMENT and TYPE_PERMISSION. When null, every type other than Permission is matched.sortAttribute- The property to sort the results by in ascending order. Pass null to leave the results unsorted.- Returns:
- The matching ManagedAttributeDetails, at most 250 of them. Narrow the criteria to reduce the results. Empty if nothing matched.
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errorsNullPointerException- when sourceId is null- See Also:
-
getIdentityById
Fetch an identity by the internal id.- Parameters:
id- The id to use when fetching an identity object- Returns:
- A DTO representing the Identity, will throw if identity was not found
-
findIdentitiesBySearchableIdentityAttribute
List<Identity> findIdentitiesBySearchableIdentityAttribute(String attributeName, String operation, String value, String sortAttribute) Find and return the users that match the incoming attributeName, operation, value ordered by the specified sortAttribute- Parameters:
attributeName- The attribute that should be searched, must be searchable and non-nulloperation- The operation to be used when searching; only Equals and StartsWith are supportedvalue- The value that should match and must be non-nullsortAttribute- The attribute that should be used while sorting Default ordering will be on uid if not specified and this also must be searchable Sort will always be in ascending order- Returns:
- The List of users that match the passed in parameters. The max number returned values will be limited to 50.
- Throws:
IllegalStateException- when attribute provided is not searchable, when operation is not StartsWith or Equals, the sortAttribute is not searchable, or if there are issues during the search- See Also:
-
countIdentitiesBySearchableIdentityAttribute
int countIdentitiesBySearchableIdentityAttribute(String attributeName, String operation, String value) Count and return the number of users that match the incoming attributeName, operation and value.- Parameters:
attributeName- The attribute that should be searched, must be searchable and non-nulloperation- The operation to be used when searching; only Equals and StartsWith are supportedvalue- The value that should match and must be non-null- Returns:
- The number of identities that match the parameters
- Throws:
IllegalStateException- when attribute provided is not searchable, when operation is not StartsWith or Equals, or if there are issues during the count operation- See Also:
-
isUniqueLDAPValue
boolean isUniqueLDAPValue(String identityNameOrId, String applicationNameOrId, String attributeName, String attributeValue) A method that can be used to call LDAP type connectors to look for unique values. The connector is called with a specific search filter based on the attributeName and value that is passed into this method. If there is a value returned the values is considered to be non-unique.- Parameters:
identityNameOrId- The name or ID of the identity we are usingapplicationNameOrId- The name or ID of the source we are targetingattributeName- The name of the attribute we want to validateattributeValue- The value of the attribute we want to validate- Returns:
- true if the value is unique AND false otherwise. If the source or identity can't be found an IllegalStateException will be thrown.
-
getSourceAttributeBySourceId
String getSourceAttributeBySourceId(String sourceId, String attributeName) throws sailpoint.tools.GeneralException Get a single Source string attribute from a source using the source id- Parameters:
sourceId- The id of the sourceattributeName- The name/key of the attribute to return- Returns:
- The value if found in the attributes
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
getSourceAttributeBySourceName
String getSourceAttributeBySourceName(String sourceName, String attributeName) throws sailpoint.tools.GeneralException Get a single Source string attribute from a source using the source name- Parameters:
sourceName- The internal name of the source, i.e. application.getName() rather than the display nameattributeName- The name/key of the attribute to return- Returns:
- The value if found in the attributes
- Throws:
sailpoint.tools.GeneralException- wrapping underlying DB related errors
-
isUniqueAccountId
A method that will call getObject() on the connector for the Account type and test if an account with the given accountId exists. If the account exists the method will return false, otherwise true.- Parameters:
identityNameOrId- The name or ID of the identity we are usingapplicationNameOrId- The name or ID of the source we are targetingaccountId- The accountId we are trying to validate- Returns:
- true if the account is unique, false otherwise
-
otoa
Convert an object to a String.- Parameters:
object- The object to convert- Returns:
- The String value for a non-null object, null otherwise
-
otob
Convert an object to a boolean.- Parameters:
object- The object to convert- Returns:
- True if the object is a true Boolean or the String "true" ignoring case, false otherwise
-
asList
Return the given object as a List. A List is returned as is, any other collection is copied into a new List, and a non-collection is wrapped in a new single element List.- Parameters:
object- The object to return as a List- Returns:
- The object as a List, or null if the object is null
-
nullSafeEq
Perform a null-safe equality comparison between two objects. Two null objects are not equal.- Parameters:
o1- The first object to compareo2- The second object to compare- Returns:
- True if both objects are non-null and equal
-
nullSafeEq
Perform a null-safe equality comparison between two objects, choosing whether two nulls are equal.- Parameters:
o1- The first object to compareo2- The second object to comparenullsEq- Whether two null objects should be considered equal- Returns:
- True if the objects are equal under the rules above
-
nullSafeCaseInsensitiveEq
Perform a null-safe, case-insensitive equality comparison between two Strings. Two null Strings are equal.- Parameters:
o1- The first String to compareo2- The second String to compare- Returns:
- True if the Strings are equal ignoring case
-
nullSafeCompareTo
Compare two objects that may be null. Two nulls are equal, and a null sorts after a non-null.- Type Parameters:
T- The Comparable type of the objects being compared- Parameters:
o1- The first object to compareo2- The second object to compare- Returns:
- A negative number, zero or a positive number as o1 sorts before, with, or after o2
-
dateToString
Format a Date as a String using the JVM's default time zone.- Parameters:
src- The date to formatformat- The date format to apply- Returns:
- The formatted date
-
dateToString
Format a Date as a String in the supplied time zone.- Parameters:
src- The date to formatformat- The date format to applytz- The time zone to format the date in- Returns:
- The formatted date
-