public class IdnRuleUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
EQUALS_FILTER |
static java.lang.String |
STARTS_WITH_FILTER |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accountExistsByDisplayName(java.lang.String applicationName,
java.lang.String displayName)
Determines if an account currently exists on an application using the display name.
|
boolean |
accountExistsByNativeIdentity(java.lang.String applicationName,
java.lang.String nativeIdentity)
Determines if an account currently exists on an application using the native identity.
|
static java.util.List |
asList(java.lang.Object object)
Return a List with the given object.
|
int |
attrSearchCountAccounts(java.util.List<java.lang.String> sourceIds,
java.lang.String attributeName,
java.lang.String operation,
java.util.List<java.lang.String> values)
Count the accounts that match the searchable attribute and value.
|
java.lang.String |
attrSearchGetIdentityName(java.util.List<java.lang.String> sourceIds,
java.lang.String attributeName,
java.lang.String operation,
java.util.List<java.lang.String> values)
Get the identity name for the account matching the specified criteria.
|
int |
countAccounts(java.lang.String applicationName)
Counts the number of accounts on an application.
|
int |
countIdentitiesBySearchableIdentityAttribute(java.lang.String attributeName,
java.lang.String operation,
java.lang.String value)
Count and return the number of users that match the incoming attributeName, operation and value.
|
protected QueryOptions |
createIdentityAttributeQueryOptions(java.lang.String attributeName,
java.lang.String operation,
java.lang.String value)
Create the QueryOptions for the given parameters.
|
static java.lang.String |
dateToString(java.util.Date src,
java.lang.String format)
Format a Date value as a String, using the JVMs default
timezone.
|
static java.lang.String |
dateToString(java.util.Date src,
java.lang.String format,
java.util.TimeZone tz)
Format a Date value as a String, using the JVMs default
timezone.
|
java.util.List<Identity> |
findIdentitiesBySearchableIdentityAttribute(java.lang.String attributeName,
java.lang.String operation,
java.lang.String value,
java.lang.String sortAttribute)
Find and return the users that match the incoming attributeName, operation, value ordered by
the specified sortAttribute
|
java.lang.String |
getAccountAttribute(Account account,
java.lang.String attribute)
Gets the String value of an attribute from an account on an application.
|
java.lang.String |
getAccountAttribute(java.lang.String applicationName,
java.lang.String nativeIdentity,
java.lang.String attribute)
Gets the String value of an attribute from an account on an application.
|
boolean |
getAccountAttributeBool(Account account,
java.lang.String attribute)
Gets the boolean value of an attribute from an account on an application.
|
boolean |
getAccountAttributeBool(java.lang.String applicationName,
java.lang.String nativeIdentity,
java.lang.String attribute)
Gets the boolean value of an attribute from an account on an application.
|
int |
getAccountAttributeInt(Account account,
java.lang.String attribute)
Gets the int value of an attribute from an account on an application.
|
int |
getAccountAttributeInt(java.lang.String applicationName,
java.lang.String nativeIdentity,
java.lang.String attribute)
Gets the int value of an attribute from an account on an application.
|
Account |
getAccountByDisplayName(java.lang.String applicationName,
java.lang.String displayName)
Gets an account on an application using the display name.
|
Account |
getAccountByNativeIdentity(java.lang.String applicationName,
java.lang.String nativeIdentity)
Gets an account on an application using the native identity.
|
java.util.List<Account> |
getAllAccounts(java.lang.String applicationName,
java.lang.String identityName)
Given the name of the application and the identity name return the list of
Account objects found for the identity.
|
protected ConnectorServiceResolver |
getConnectorService()
Method is separate from main code to allow me to mock out the connector interaction as part of
an integration test.
|
Account |
getFirstAccount(java.lang.String applicationName,
java.lang.String identityName)
Get the first account found for the application and identityName.
|
java.lang.String |
getFirstAccountNativeIdentity(java.lang.String applicationName,
java.lang.String identityName)
Get the first account for the application and identityName and return the first accounts native Identity.
|
Identity |
getIdentityById(java.lang.String id)
Fetch an identity by the internal id.
|
protected LDAPConnectorServiceResolver |
getLDAPConnectorService()
Method is separate from main code to allow me to mock out the connector interaction as part of
an integration test.
|
java.lang.String |
getManagedAttributeDescription(java.lang.String sourceId,
java.lang.String name,
java.lang.String value,
ManagedAttribute.Type type)
Finds ManagedAttribute description by provided sourceId/name/value/type.
|
ManagedAttributeDetails |
getManagedAttributeDetails(java.lang.String sourceId,
java.lang.String name,
java.lang.String value,
ManagedAttribute.Type type)
Finds ManagedAttribute by sourceId/name/value/type and returns its details in ManagedAttributeDetails model.
|
java.lang.Object |
getRawAccountAttribute(Account account,
java.lang.String attribute)
Gets the value of an attribute from an account on an application.
|
java.lang.Object |
getRawAccountAttribute(java.lang.String applicationName,
java.lang.String nativeIdentity,
java.lang.String attribute)
Gets the value of an attribute from an account on an application.
|
java.lang.String |
getSourceAttributeBySourceId(java.lang.String sourceId,
java.lang.String attributeName)
Get a single Source string attribute from an Application using the applicationId
|
java.lang.String |
getSourceAttributeBySourceName(java.lang.String sourceName,
java.lang.String attributeName)
Get a single Source string attribute from an Application using the applicationId
|
boolean |
isUniqueAccountId(java.lang.String identityNameOrId,
java.lang.String applicationNameOrId,
java.lang.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.
|
boolean |
isUniqueLDAPValue(java.lang.String identityNameOrId,
java.lang.String applicationNameOrId,
java.lang.String attributeName,
java.lang.String attributeValue)
A method that can be used to call LDAP type connectors to look for
unique values.
|
static boolean |
nullSafeCaseInsensitiveEq(java.lang.String o1,
java.lang.String o2)
This method performs a null-safe equality comparison between the two strings.
|
static <T extends java.lang.Comparable> |
nullSafeCompareTo(T o1,
T o2)
Return the compareTo() value for two objects that may be null.
|
static boolean |
nullSafeEq(java.lang.Object o1,
java.lang.Object o2)
This method performs a null-safe equality comparison between the two
given objects.
|
static boolean |
nullSafeEq(java.lang.Object o1,
java.lang.Object o2,
boolean nullsEq)
This method performs a null-safe equality comparison between the two
given objects.
|
java.lang.String |
otoa(java.lang.Object object)
Convert object to a string.
|
static boolean |
otob(java.lang.Object object)
Convert object to a boolean.
|
public static final java.lang.String STARTS_WITH_FILTER
public static final java.lang.String EQUALS_FILTER
public boolean accountExistsByNativeIdentity(java.lang.String applicationName,
java.lang.String nativeIdentity)
throws GeneralException
applicationName - The application name.nativeIdentity - The native identity of the account.GeneralExceptionpublic boolean accountExistsByDisplayName(java.lang.String applicationName,
java.lang.String displayName)
throws GeneralException
applicationName - The application name.displayName - The display name of the account.GeneralExceptionpublic Account getAccountByNativeIdentity(java.lang.String applicationName, java.lang.String nativeIdentity) throws GeneralException
applicationName - The application name.nativeIdentity - The native identity of the account.GeneralExceptionpublic Account getAccountByDisplayName(java.lang.String applicationName, java.lang.String displayName) throws GeneralException
applicationName - The application name.displayName - The display name of the account.GeneralExceptionpublic java.util.List<Account> getAllAccounts(java.lang.String applicationName, java.lang.String identityName) throws GeneralException
applicationName - The name of the applicationidentityName - The name of the identityGeneralException - wrapping underlying DB related errorspublic Account getFirstAccount(java.lang.String applicationName, java.lang.String identityName) throws GeneralException
applicationName - The name of the applicationidentityName - The name of the IdentityGeneralException - wrapping underlying DB related errorspublic java.lang.String getFirstAccountNativeIdentity(java.lang.String applicationName,
java.lang.String identityName)
throws GeneralException
applicationName - The name of the applicationidentityName - The name of the identityGeneralException - wrapping underlying DB related errorspublic int countAccounts(java.lang.String applicationName)
throws GeneralException
applicationName - The application name.GeneralExceptionpublic java.lang.Object getRawAccountAttribute(java.lang.String applicationName,
java.lang.String nativeIdentity,
java.lang.String attribute)
throws GeneralException
applicationName - The application name.nativeIdentity - The native identity of the account.attribute - The name of the attribute to retrieve.GeneralExceptionpublic java.lang.Object getRawAccountAttribute(Account account, java.lang.String attribute)
account - The account on the application.attribute - The name of the attribute to retrieve.public java.lang.String getAccountAttribute(java.lang.String applicationName,
java.lang.String nativeIdentity,
java.lang.String attribute)
throws GeneralException
applicationName - The application name.nativeIdentity - The native identity of the account.attribute - The name of the attribute to retrieve.GeneralExceptionpublic java.lang.String getAccountAttribute(Account account, java.lang.String attribute)
account - The account on the application.attribute - The name of the attribute to retrieve.public boolean getAccountAttributeBool(java.lang.String applicationName,
java.lang.String nativeIdentity,
java.lang.String attribute)
throws GeneralException
applicationName - The application name.nativeIdentity - The native identity of the account.attribute - The name of the attribute to retrieve.GeneralExceptionpublic boolean getAccountAttributeBool(Account account, java.lang.String attribute)
account - The account on the application.attribute - The name of the attribute to retrieve.public int attrSearchCountAccounts(java.util.List<java.lang.String> sourceIds,
java.lang.String attributeName,
java.lang.String operation,
java.util.List<java.lang.String> values)
sourceIds - The list of Application 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 Operation.Equal OR Operation.StartsWithvalues - The value of that searchable attribute to math. The value parameter is required.public java.lang.String attrSearchGetIdentityName(java.util.List<java.lang.String> sourceIds,
java.lang.String attributeName,
java.lang.String operation,
java.util.List<java.lang.String> values)
sourceIds - The list of Application 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 Operation.Equal OR Operation.StartsWithvalues - The value of that searchable attribute to math. The value parameter is required.public Identity getIdentityById(java.lang.String id)
id - The id to use when fetchingpublic java.util.List<Identity> findIdentitiesBySearchableIdentityAttribute(java.lang.String attributeName, java.lang.String operation, java.lang.String value, java.lang.String sortAttribute)
attributeName - The attribute that should be searched, must be searchable and non-null.operation - The operation to be used when searching and only allowed equals and starts withvalue - 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 orderjava.lang.IllegalStateException - when attribute provided is not searchable,
when operation is not StartsWith or Equals,
the sortAttribute is not searahable,
or if there are issues during the searchEQUALS_FILTER,
STARTS_WITH_FILTERpublic int countIdentitiesBySearchableIdentityAttribute(java.lang.String attributeName,
java.lang.String operation,
java.lang.String value)
attributeName - The attribute that should be searched, must be searchable and non-null.operation - The operation to be used when searching and only allowed equals and starts withvalue - The value that should match and must be non-nulljava.lang.IllegalStateException - when attribute provided is not searchable,
when operation is not StartsWith or Equals,
or if there are issues during the count operationEQUALS_FILTER,
STARTS_WITH_FILTERprotected QueryOptions createIdentityAttributeQueryOptions(java.lang.String attributeName, java.lang.String operation, java.lang.String value)
attributeName - The attribute that should be searched, must be searchable and non-null.operation - The operation to be used when searching and only allowed equals and starts withvalue - The value that should match and must be non-nullpublic int getAccountAttributeInt(java.lang.String applicationName,
java.lang.String nativeIdentity,
java.lang.String attribute)
throws GeneralException
applicationName - The application name.nativeIdentity - The native identity of the account.attribute - The name of the attribute to retrieve.GeneralExceptionpublic int getAccountAttributeInt(Account account, java.lang.String attribute)
account - The account on the application.attribute - The name of the attribute to retrieve.public java.lang.String getManagedAttributeDescription(java.lang.String sourceId,
java.lang.String name,
java.lang.String value,
ManagedAttribute.Type type)
throws GeneralException
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).GeneralException - wrapping underlying DB related errorspublic ManagedAttributeDetails getManagedAttributeDetails(java.lang.String sourceId, java.lang.String name, java.lang.String value, ManagedAttribute.Type type) throws GeneralException
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).GeneralException - wrapping underlying DB related errorspublic java.lang.String getSourceAttributeBySourceId(java.lang.String sourceId,
java.lang.String attributeName)
throws GeneralException
sourceId - The id of the sourceattributeName - The name/key of the attribute to returnGeneralException - wrapping underlying DB related errorspublic java.lang.String getSourceAttributeBySourceName(java.lang.String sourceName,
java.lang.String attributeName)
throws GeneralException
sourceName - (internal name i.e. application.getName() vs displayName of the applicationattributeName - The name/key of the attribute to returnGeneralException - wrapping underlying DB related errorspublic boolean isUniqueLDAPValue(java.lang.String identityNameOrId,
java.lang.String applicationNameOrId,
java.lang.String attributeName,
java.lang.String attributeValue)
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 validateprotected LDAPConnectorServiceResolver getLDAPConnectorService()
public boolean isUniqueAccountId(java.lang.String identityNameOrId,
java.lang.String applicationNameOrId,
java.lang.String accountId)
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 validateprotected ConnectorServiceResolver getConnectorService()
public java.lang.String otoa(java.lang.Object object)
object - object to convertpublic static boolean otob(java.lang.Object object)
object - object to convertpublic static java.util.List asList(java.lang.Object object)
object - The object to return as a list.public static boolean nullSafeEq(java.lang.Object o1,
java.lang.Object o2)
o1 - The first object to compare.o2 - The second object to compare.public static boolean nullSafeEq(java.lang.Object o1,
java.lang.Object o2,
boolean nullsEq)
public static boolean nullSafeCaseInsensitiveEq(java.lang.String o1,
java.lang.String o2)
public static <T extends java.lang.Comparable> int nullSafeCompareTo(T o1,
T o2)
public static java.lang.String dateToString(java.util.Date src,
java.lang.String format)
src - The source Stringformat - The date format to applypublic static java.lang.String dateToString(java.util.Date src,
java.lang.String format,
java.util.TimeZone tz)
src - The source Stringformat - The date format to applytz -