Search in sources :

Example 6 with AS400SecurityException

use of com.ibm.as400.access.AS400SecurityException in project DCM-tools by ThePrez.

the class DcmApiCaller method callQycdUpdateCertUsage.

public void callQycdUpdateCertUsage(final AppLogger _logger, final String _appId, final String _certStoreName, final String _certId) throws PropertyVetoException, AS400SecurityException, ErrorCompletingRequestException, IOException, InterruptedException, ObjectDoesNotExistException {
    final ServiceProgramCall program = new ServiceProgramCall(m_conn);
    final String programName = "/QSYS.LIB/QICSS.LIB/QYCDCUSG.SRVPGM";
    final ProgramParameter[] parameterList = new ProgramParameter[8];
    // 1 Application ID Output Char(*)
    parameterList[0] = new ProgramParameter(new AS400Text(_appId.length()).toBytes(_appId));
    // 2 Length of application ID Input Binary(4)
    parameterList[1] = new ProgramParameter(new AS400Bin4().toBytes(_appId.length()));
    // 3 Certificate store name Input Char(*)
    parameterList[2] = new ProgramParameter(new AS400Text(_certStoreName.length()).toBytes(_certStoreName));
    // 4 Length of certificate store name Input Binary(4)
    parameterList[3] = new ProgramParameter(new AS400Bin4().toBytes(_certStoreName.length()));
    // 5 Certificate ID type Input Char(*)
    parameterList[4] = new ProgramParameter(new AS400Text(1).toBytes("1"));
    // 6 Certificate ID Input Char(*)
    parameterList[5] = new ProgramParameter(new AS400Text(_certId.length()).toBytes(_certId));
    // 7 Length of certificate ID Input Binary(4)
    parameterList[6] = new ProgramParameter(new AS400Bin4().toBytes(_certId.length()));
    // 8 Error code I/O Char(*)
    final ErrorCodeParameter ec = new ErrorCodeParameter(true, true);
    parameterList[7] = ec;
    program.setProgram(programName, parameterList);
    program.setProcedureName("QycdUpdateCertUsage");
    // Run the program.
    runProgram(_logger, program, ec);
}
Also used : ErrorCodeParameter(com.ibm.as400.access.ErrorCodeParameter) ServiceProgramCall(com.ibm.as400.access.ServiceProgramCall) ProgramParameter(com.ibm.as400.access.ProgramParameter) AS400Text(com.ibm.as400.access.AS400Text) AS400Bin4(com.ibm.as400.access.AS400Bin4)

Example 7 with AS400SecurityException

use of com.ibm.as400.access.AS400SecurityException in project openicf by Evolveum.

the class OS400Connector method init.

/**
 * Callback method to receive the {@link Configuration}.
 *
 * @see Connector#init(org.identityconnectors.framework.spi.Configuration)
 */
public void init(Configuration configuration1) {
    this.configuration = (OS400Configuration) configuration1;
    if (as400 == null) {
        try {
            final StringBuilder clear = new StringBuilder();
            GuardedString.Accessor accessor = new GuardedString.Accessor() {

                public void access(char[] clearChars) {
                    clear.append(clearChars);
                }
            };
            configuration.getPassword().access(accessor);
            if (configuration.isSsl()) {
                as400 = new SecureAS400(configuration.getHost(), configuration.getRemoteUser(), clear.toString());
            } else {
                as400 = new AS400(configuration.getHost(), configuration.getRemoteUser(), clear.toString());
            }
            clear.setLength(0);
            if (as400 == null) {
                throw new ConnectorException("Connection Exception");
            }
            if (!as400.validateSignon()) {
                throw new ConnectorSecurityException("Login Error");
            }
            try {
                as400.setGuiAvailable(false);
                fetchPasswordLevel();
            } catch (Exception e) {
            }
        } catch (AS400SecurityException e) {
            throw new ConnectorSecurityException(e);
        } catch (IOException e) {
            throw new ConnectorIOException(e);
        }
    }
}
Also used : ConnectorIOException(org.identityconnectors.framework.common.exceptions.ConnectorIOException) SecureAS400(com.ibm.as400.access.SecureAS400) AS400SecurityException(com.ibm.as400.access.AS400SecurityException) ConnectorException(org.identityconnectors.framework.common.exceptions.ConnectorException) SecureAS400(com.ibm.as400.access.SecureAS400) AS400(com.ibm.as400.access.AS400) GuardedString(org.identityconnectors.common.security.GuardedString) ConnectorSecurityException(org.identityconnectors.framework.common.exceptions.ConnectorSecurityException) ConnectorIOException(org.identityconnectors.framework.common.exceptions.ConnectorIOException) IOException(java.io.IOException) ConnectorSecurityException(org.identityconnectors.framework.common.exceptions.ConnectorSecurityException) IntrospectionException(java.beans.IntrospectionException) ConnectorIOException(org.identityconnectors.framework.common.exceptions.ConnectorIOException) ConnectorException(org.identityconnectors.framework.common.exceptions.ConnectorException) RequestNotSupportedException(com.ibm.as400.access.RequestNotSupportedException) IOException(java.io.IOException) AS400SecurityException(com.ibm.as400.access.AS400SecurityException)

Aggregations

AS400Bin4 (com.ibm.as400.access.AS400Bin4)6 AS400Text (com.ibm.as400.access.AS400Text)6 ErrorCodeParameter (com.ibm.as400.access.ErrorCodeParameter)6 ProgramParameter (com.ibm.as400.access.ProgramParameter)6 ServiceProgramCall (com.ibm.as400.access.ServiceProgramCall)6 ProgramCall (com.ibm.as400.access.ProgramCall)3 AS400 (com.ibm.as400.access.AS400)1 AS400SecurityException (com.ibm.as400.access.AS400SecurityException)1 AS400Structure (com.ibm.as400.access.AS400Structure)1 RequestNotSupportedException (com.ibm.as400.access.RequestNotSupportedException)1 SecureAS400 (com.ibm.as400.access.SecureAS400)1 IntrospectionException (java.beans.IntrospectionException)1 IOException (java.io.IOException)1 GuardedString (org.identityconnectors.common.security.GuardedString)1 ConnectorException (org.identityconnectors.framework.common.exceptions.ConnectorException)1 ConnectorIOException (org.identityconnectors.framework.common.exceptions.ConnectorIOException)1 ConnectorSecurityException (org.identityconnectors.framework.common.exceptions.ConnectorSecurityException)1