Package com.identityworksllc.iiq.common
Class IQServiceUtilities
- java.lang.Object
-
- com.identityworksllc.iiq.common.IQServiceUtilities
-
public class IQServiceUtilities extends Object
Utilities for interacting with the IQService, particularly for executing Powershell
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IQServiceUtilities.RPCRequestBuilder
A fluent builder forRpcRequest
objects
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIG_DISABLE_HOSTNAME_VERIFICATION
The ‘hidden’ input to disable hostname verificationstatic String
DEFAULT_TEMPLATE_OUTPUT
The output variable returned by the default templatestatic String
IQSERVICE_FIELD_APPLICATION
The input argument containing the Application’s attributesstatic String
IQSERVICE_FIELD_REQUEST
The input argument containing anProvisioningPlan.AccountRequest
static String
IQSERVICE_FIELD_RULE
The input argument containing the actual Powershell script to runstatic String
RUN_AFTER_SCRIPT
The default Powershell script typestatic String
SCRIPT_EXECUTOR
The default RPC Service type, execution of a Powershell scriptstatic String
STANDARD_POWERSHELL_TEMPLATE
The path to the standard powershell template, which should be included with this librarystatic String
TOKEN_USER_COMMAND
The token in the wrapper script to replace with the user commands
-
Constructor Summary
Constructors Constructor Description IQServiceUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static sailpoint.object.RpcResponse
checkRpcFailure(sailpoint.object.RpcResponse response)
Checks theRpcResponse
for error messages.static sailpoint.object.RpcResponse
checkRpcFailure(sailpoint.object.RpcResponse response, org.apache.commons.logging.Log yourLogger)
Checks the RpcResponse for error messages.static sailpoint.object.ProvisioningPlan.AccountRequest
createFakeAccountRequest(Map<String,Object> parameters)
Constructs a fake account request to use for a call to IIQstatic Map<String,Object>
createRPCRequestContent(String commands, sailpoint.object.Application connectionInfo, Map<String,Object> inputs)
Creates a map to be passed to an RPCRequest.static Map<String,Object>
createRPCRequestContent(sailpoint.object.Rule rule, Map<String,Object> connectionInfo, Map<String,Object> inputs)
Creates a map to be passed to an RPCRequest.static Map<String,Object>
createRPCRequestContent(sailpoint.object.Rule rule, Map<String,Object> connectionInfo, sailpoint.object.ProvisioningPlan.AccountRequest inputs)
Creates a map to be passed to an RPCRequest.static Map<String,Object>
createRPCRequestContent(sailpoint.object.Rule rule, sailpoint.object.Application connectionInfo, Map<String,Object> inputs)
Creates a map to be passed to an RPCRequest.static sailpoint.connector.RPCService
createRPCService(Map<String,Object> connectionInfo)
Constructs an RPCService from the connection info providedstatic Map<String,Object>
findIQServiceConfig(Map<String,Object> connectionInfo)
Finds the IQService config.static String
getStandardTemplate()
Get standard template from the classpathstatic boolean
supportsTLS()
Returns true if the RPCService in this instance of IIQ supports TLS.static sailpoint.object.Rule
wrapPowershellCommands(String commands, String ruleTextTemplate)
Wraps Powershell commands into a Rule, substituting it into a template wrapper.
-
-
-
Field Detail
-
CONFIG_DISABLE_HOSTNAME_VERIFICATION
public static final String CONFIG_DISABLE_HOSTNAME_VERIFICATION
The ‘hidden’ input to disable hostname verification- See Also:
- Constant Field Values
-
DEFAULT_TEMPLATE_OUTPUT
public static final String DEFAULT_TEMPLATE_OUTPUT
The output variable returned by the default template- See Also:
- Constant Field Values
-
IQSERVICE_FIELD_APPLICATION
public static final String IQSERVICE_FIELD_APPLICATION
The input argument containing the Application’s attributes- See Also:
- Constant Field Values
-
IQSERVICE_FIELD_REQUEST
public static final String IQSERVICE_FIELD_REQUEST
The input argument containing anProvisioningPlan.AccountRequest
- See Also:
- Constant Field Values
-
IQSERVICE_FIELD_RULE
public static final String IQSERVICE_FIELD_RULE
The input argument containing the actual Powershell script to run- See Also:
- Constant Field Values
-
RUN_AFTER_SCRIPT
public static final String RUN_AFTER_SCRIPT
The default Powershell script type- See Also:
- Constant Field Values
-
SCRIPT_EXECUTOR
public static final String SCRIPT_EXECUTOR
The default RPC Service type, execution of a Powershell script- See Also:
- Constant Field Values
-
STANDARD_POWERSHELL_TEMPLATE
public static final String STANDARD_POWERSHELL_TEMPLATE
The path to the standard powershell template, which should be included with this library- See Also:
- Constant Field Values
-
TOKEN_USER_COMMAND
public static final String TOKEN_USER_COMMAND
The token in the wrapper script to replace with the user commands- See Also:
- Constant Field Values
-
-
Constructor Detail
-
IQServiceUtilities
public IQServiceUtilities()
-
-
Method Detail
-
checkRpcFailure
protected static sailpoint.object.RpcResponse checkRpcFailure(sailpoint.object.RpcResponse response) throws sailpoint.tools.GeneralException
Checks theRpcResponse
for error messages.If there are any, it throws an exception with the messages. If the RpcResponse contains any messages, they will be logged as warnings.
The default logger will be used. If you wish to provide your own logger, use the two-argument
checkRpcFailure(RpcResponse, Log)
.- Parameters:
response
- the response to check- Returns:
- the same response
- Throws:
sailpoint.tools.GeneralException
- if there were any errors
-
checkRpcFailure
public static sailpoint.object.RpcResponse checkRpcFailure(sailpoint.object.RpcResponse response, org.apache.commons.logging.Log yourLogger) throws sailpoint.tools.GeneralException
Checks the RpcResponse for error messages.If there are any, it throws an exception with the messages. If the RpcResponse contains any messages, they will be logged as warnings.
- Parameters:
response
- the response to checkyourLogger
- The logger ot which the errors should be logged- Returns:
- the same response
- Throws:
sailpoint.tools.GeneralException
- if there were any errors
-
createFakeAccountRequest
public static sailpoint.object.ProvisioningPlan.AccountRequest createFakeAccountRequest(Map<String,Object> parameters)
Constructs a fake account request to use for a call to IIQ- Parameters:
parameters
- Any parameters to send to the IIQ call- Returns:
- The account request
-
createRPCRequestContent
public static Map<String,Object> createRPCRequestContent(sailpoint.object.Rule rule, sailpoint.object.Application connectionInfo, Map<String,Object> inputs)
Creates a map to be passed to an RPCRequest.- Parameters:
rule
- The rule to executeconnectionInfo
- The Application containing connection intoinputs
- The rule inputs- Returns:
- The populated Map
-
createRPCRequestContent
public static Map<String,Object> createRPCRequestContent(sailpoint.object.Rule rule, Map<String,Object> connectionInfo, sailpoint.object.ProvisioningPlan.AccountRequest inputs)
Creates a map to be passed to an RPCRequest.- Parameters:
rule
- The rule to executeconnectionInfo
- The Map containing connection intoinputs
- The rule inputs- Returns:
- The populated Map
-
createRPCRequestContent
public static Map<String,Object> createRPCRequestContent(sailpoint.object.Rule rule, Map<String,Object> connectionInfo, Map<String,Object> inputs)
Creates a map to be passed to an RPCRequest.- Parameters:
rule
- The rule to executeconnectionInfo
- The Map containing connection intoinputs
- The rule inputs- Returns:
- The populated Map
-
createRPCRequestContent
public static Map<String,Object> createRPCRequestContent(String commands, sailpoint.object.Application connectionInfo, Map<String,Object> inputs) throws sailpoint.tools.GeneralException
Creates a map to be passed to an RPCRequest.- Parameters:
commands
- The Powershell commands to execute; will be translated viawrapPowershellCommands(String, String)
connectionInfo
- The Application containing connection intoinputs
- The rule inputs- Returns:
- The populated Map
- Throws:
sailpoint.tools.GeneralException
- if constructing request input fails, usually because of failure to read the template
-
createRPCService
public static sailpoint.connector.RPCService createRPCService(Map<String,Object> connectionInfo)
Constructs an RPCService from the connection info provided- Parameters:
connectionInfo
- The connection info from an Application or other config- Returns:
- The resulting RPCService
-
findIQServiceConfig
public static Map<String,Object> findIQServiceConfig(Map<String,Object> connectionInfo)
Finds the IQService config.This is isolated here so that we can ignore warnings on as small a bit of code as possible
- Parameters:
connectionInfo
- The connection info from the application or other config- Returns:
- The IQService config, either the original, or extracted
-
getStandardTemplate
public static String getStandardTemplate() throws IOException, sailpoint.tools.GeneralException
Get standard template from the classpath- Returns:
- The standard template
- Throws:
IOException
- If any errors occur opening the template streamsailpoint.tools.GeneralException
- If any errors occur parsing the template stream
-
supportsTLS
public static boolean supportsTLS()
Returns true if the RPCService in this instance of IIQ supports TLS.The TLS four and five-argument constructors to IQService are available in the following IIQ versions and higher:
- 8.0 GA
- 7.3p3
- 7.2p4
- 7.1p7
This result is cached.
- Returns:
- True if it supports TLS, false otherwise
-
wrapPowershellCommands
public static sailpoint.object.Rule wrapPowershellCommands(String commands, String ruleTextTemplate) throws sailpoint.tools.GeneralException
Wraps Powershell commands into a Rule, substituting it into a template wrapper.This
Rule
should not be saved, but should be serialized directly with the input to the RPCService.- Parameters:
commands
- The commands to execute in PowershellruleTextTemplate
- The rule text template, or null to use the included default- Returns:
- The resulting Rule object
- Throws:
sailpoint.tools.GeneralException
- if constructing the new Rule fails
-
-