java.security.KeyException Java Examples

The following examples show how to use java.security.KeyException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SchedulerFrontendTest.java    From scheduling with GNU Affero General Public License v3.0 6 votes vote down vote up
@Test
public void testRestartAllInErrorTasks() throws KeyException, AlreadyConnectedException, NotConnectedException,
        PermissionException, UnknownJobException {

    Mockito.when(frontendState.getIdentifiedJob(jobId)).thenReturn(ij);
    Mockito.when(ij.isFinished()).thenReturn(false);
    Mockito.when(frontendState.getJobState(jobId)).thenReturn(jobstate);

    try {
        schedulerFrontend.restartAllInErrorTasks("123");
    } catch (Exception e) {
    }

    Mockito.verify(frontendState, times(1))
           .checkPermissions("restartAllInErrorTasks",
                             ij,
                             YOU_DO_NOT_HAVE_PERMISSION_TO_RESTART_IN_ERROR_TASKS_IN_THIS_JOB);

}
 
Example #2
Source File: SchedulerStateRecoverHelperTest.java    From scheduling with GNU Affero General Public License v3.0 6 votes vote down vote up
@Test
public void testRecoverWithCopyAndSortThrowingRuntimeException() throws KeyException, JobCreationException {
    RecoveredSchedulerState recoveredState = new Scenario(createJob(JobStatus.RUNNING)).execute(new SchedulerStateRecoverHelperSupplier() {
        @Override
        public SchedulerStateRecoverHelper get(SchedulerDBManager dbManager) {
            return new SchedulerStateRecoverHelper(dbManager) {
                @Override
                protected List<InternalTask> copyAndSort(List<InternalTask> tasks) {
                    throw new RuntimeException("bouh!");
                }
            };
        }
    }, false);

    assertThat(recoveredState.getFinishedJobs()).hasSize(1);
    assertThat(recoveredState.getPendingJobs()).hasSize(0);
    assertThat(recoveredState.getRunningJobs()).hasSize(0);

    assertThat(recoveredState.getFinishedJobs().get(0).getStatus()).isEqualTo(JobStatus.CANCELED);
}
 
Example #3
Source File: SchedulerStateRest.java    From scheduling with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public byte[] getCreateCredential(LoginForm multipart) throws LoginException, SchedulerRestException {

    String username = multipart.getUsername();
    String password = multipart.getPassword();
    byte[] privKey = multipart.getSshKey();

    try {
        String url = PortalConfiguration.SCHEDULER_URL.getValueAsString();
        SchedulerAuthenticationInterface auth = SchedulerConnection.join(url);
        PublicKey pubKey = auth.getPublicKey();
        sessionStore.create(username);
        Credentials cred = Credentials.createCredentials(new CredData(CredData.parseLogin(username),
                                                                      CredData.parseDomain(username),
                                                                      password,
                                                                      privKey),
                                                         pubKey);
        return cred.getBase64();
    } catch (ConnectionException | KeyException e) {
        throw new SchedulerRestException(e);
    }
}
 
Example #4
Source File: MetadataEncryptor.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Decrypt a property if the data definition (model-specific) requires it.
 * 
 * @param propertyQName             the property qualified name
 * @param inbound                   the property to decrypt
 * @return                          the decrypted property or the original if it wasn't encrypted
 */
public Serializable decrypt(QName propertyQName, Serializable inbound)
{
    PropertyDefinition propertyDef = dictionaryService.getProperty(propertyQName);
    if (inbound == null || propertyDef == null || !(propertyDef.getDataType().getName().equals(DataTypeDefinition.ENCRYPTED)))
    {
        return inbound;
    }
    if (!(inbound instanceof SealedObject))
    {
        return inbound;
    }
    try
    {
     Serializable outbound = encryptor.unsealObject(KeyProvider.ALIAS_METADATA, inbound);
     // Done
     return outbound;
    }
    catch(KeyException e)
    {
    	throw new AlfrescoRuntimeException("Invalid metadata decryption key", e);
    }
}
 
Example #5
Source File: SchedulerFrontendTest.java    From scheduling with GNU Affero General Public License v3.0 6 votes vote down vote up
@Test
public void testGetJobServerLogs() throws KeyException, AlreadyConnectedException, NotConnectedException,
        PermissionException, UnknownJobException {

    Mockito.when(frontendState.getIdentifiedJob(jobId)).thenReturn(ij);
    Mockito.when(ij.isFinished()).thenReturn(false);
    Mockito.when(frontendState.getJobState(jobId)).thenReturn(jobstate);

    try {
        schedulerFrontend.getJobServerLogs("123");
    } catch (Exception e) {
    }

    Mockito.verify(frontendState, times(1))
           .checkPermissions("getJobServerLogs", ij, YOU_DO_NOT_HAVE_PERMISSIONS_TO_GET_THE_LOGS_OF_THIS_JOB);

}
 
Example #6
Source File: DOMKeyValue.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof KeyValue)) {
        return false;
    }
    try {
        KeyValue kv = (KeyValue)obj;
        if (publicKey == null ) {
            if (kv.getPublicKey() != null) {
                return false;
            }
        } else if (!publicKey.equals(kv.getPublicKey())) {
            return false;
        }
    } catch (KeyException ke) {
        // no practical way to determine if the keys are equal
        return false;
    }

    return true;
}
 
Example #7
Source File: XMLSignatureUtil.java    From keycloak with Apache License 2.0 6 votes vote down vote up
private static KeyInfo createKeyInfo(String keyName, PublicKey publicKey, X509Certificate x509Certificate) throws KeyException {
    KeyInfoFactory keyInfoFactory = fac.getKeyInfoFactory();

    List<XMLStructure> items = new LinkedList<>();

    if (keyName != null) {
        items.add(keyInfoFactory.newKeyName(keyName));
    }

    if (x509Certificate != null) {
        items.add(keyInfoFactory.newX509Data(Collections.singletonList(x509Certificate)));
    }

    if (publicKey != null) {
        items.add(keyInfoFactory.newKeyValue(publicKey));
    }

    return keyInfoFactory.newKeyInfo(items);
}
 
Example #8
Source File: STSServiceImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void signRequest(Element requestElement, PrivateKey privateKey, Object keyInfoValue) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, MarshalException, XMLSignatureException, KeyException {
   DOMSignContext domSignContext = new DOMSignContext(privateKey, requestElement, requestElement.getFirstChild());
   String requestId = requestElement.getAttribute("RequestID");
   requestElement.setIdAttribute("RequestID", true);
   List<Transform> transforms = new LinkedList();
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2000/09/xmldsig#enveloped-signature", (TransformParameterSpec)null));
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null));
   Reference reference = xmlSignatureFactory.newReference("#" + requestId, xmlSignatureFactory.newDigestMethod("http://www.w3.org/2000/09/xmldsig#sha1", (DigestMethodParameterSpec)null), transforms, (String)null, (String)null);
   CanonicalizationMethod canonicalizationMethod = xmlSignatureFactory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null);
   SignatureMethod signatureMethod = xmlSignatureFactory.newSignatureMethod("http://www.w3.org/2000/09/xmldsig#rsa-sha1", (SignatureMethodParameterSpec)null);
   SignedInfo signedInfo = xmlSignatureFactory.newSignedInfo(canonicalizationMethod, signatureMethod, Collections.singletonList(reference));
   KeyInfoFactory keyInfoFactory = xmlSignatureFactory.getKeyInfoFactory();
   KeyInfo keyInfo = null;
   if (keyInfoValue instanceof PublicKey) {
      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newKeyValue((PublicKey)keyInfoValue)));
   } else {
      if (!(keyInfoValue instanceof X509Certificate)) {
         throw new IllegalArgumentException("Unsupported keyinfo type [" + keyInfoValue.getClass() + "]");
      }

      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newX509Data(Collections.singletonList(keyInfoValue))));
   }

   XMLSignature xmlSignature = xmlSignatureFactory.newXMLSignature(signedInfo, keyInfo);
   xmlSignature.sign(domSignContext);
}
 
Example #9
Source File: DOMKeyValue.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof KeyValue)) {
        return false;
    }
    try {
        KeyValue kv = (KeyValue)obj;
        if (publicKey == null ) {
            if (kv.getPublicKey() != null) {
                return false;
            }
        } else if (!publicKey.equals(kv.getPublicKey())) {
            return false;
        }
    } catch (KeyException ke) {
        // no practical way to determine if the keys are equal
        return false;
    }

    return true;
}
 
Example #10
Source File: STSServiceImpl.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
private void signRequest(Element requestElement, PrivateKey privateKey, Object keyInfoValue) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, MarshalException, XMLSignatureException, KeyException {
   DOMSignContext domSignContext = new DOMSignContext(privateKey, requestElement, requestElement.getFirstChild());
   String requestId = requestElement.getAttribute("RequestID");
   requestElement.setIdAttribute("RequestID", true);
   List<Transform> transforms = new LinkedList();
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2000/09/xmldsig#enveloped-signature", (TransformParameterSpec)null));
   transforms.add(xmlSignatureFactory.newTransform("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null));
   Reference reference = xmlSignatureFactory.newReference("#" + requestId, xmlSignatureFactory.newDigestMethod("http://www.w3.org/2000/09/xmldsig#sha1", (DigestMethodParameterSpec)null), transforms, (String)null, (String)null);
   CanonicalizationMethod canonicalizationMethod = xmlSignatureFactory.newCanonicalizationMethod("http://www.w3.org/2001/10/xml-exc-c14n#", (C14NMethodParameterSpec)null);
   SignatureMethod signatureMethod = xmlSignatureFactory.newSignatureMethod("http://www.w3.org/2000/09/xmldsig#rsa-sha1", (SignatureMethodParameterSpec)null);
   SignedInfo signedInfo = xmlSignatureFactory.newSignedInfo(canonicalizationMethod, signatureMethod, Collections.singletonList(reference));
   KeyInfoFactory keyInfoFactory = xmlSignatureFactory.getKeyInfoFactory();
   KeyInfo keyInfo = null;
   if (keyInfoValue instanceof PublicKey) {
      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newKeyValue((PublicKey)keyInfoValue)));
   } else {
      if (!(keyInfoValue instanceof X509Certificate)) {
         throw new IllegalArgumentException("Unsupported keyinfo type [" + keyInfoValue.getClass() + "]");
      }

      keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyInfoFactory.newX509Data(Collections.singletonList(keyInfoValue))));
   }

   XMLSignature xmlSignature = xmlSignatureFactory.newXMLSignature(signedInfo, keyInfo);
   xmlSignature.sign(domSignContext);
}
 
Example #11
Source File: KeyValueKeySelectorTest.java    From development with Apache License 2.0 6 votes vote down vote up
@Test()
public void select_publicKey_exception() throws Exception {
    // given
    KeyInfo keyinfo = mock(KeyInfo.class);
    ArrayList<XMLStructure> list = new ArrayList<XMLStructure>();
    KeyValue struct = mock(KeyValue.class);
    list.add(struct);
    doReturn(list).when(keyinfo).getContent();
    doThrow(new KeyException("test")).when(struct).getPublicKey();

    // when
    try {
        selector.select(keyinfo, null, null, null);
        fail();
    } catch (KeySelectorException e) {
        assertTrue(e.getCause().getMessage().contains("test"));
    }
}
 
Example #12
Source File: DOMKeyValue.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean equals(Object obj) {
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof KeyValue)) {
        return false;
    }
    try {
        KeyValue kv = (KeyValue)obj;
        if (publicKey == null ) {
            if (kv.getPublicKey() != null) {
                return false;
            }
        } else if (!publicKey.equals(kv.getPublicKey())) {
            return false;
        }
    } catch (KeyException ke) {
        // no practical way to determine if the keys are equal
        return false;
    }

    return true;
}
 
Example #13
Source File: DOMKeyValue.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public PublicKey getPublicKey() throws KeyException {
    if (publicKey == null) {
        throw new KeyException("can't convert KeyValue to PublicKey");
    } else {
        return publicKey;
    }
}
 
Example #14
Source File: DOMKeyValue.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public PublicKey getPublicKey() throws KeyException {
    if (publicKey == null) {
        throw new KeyException("can't convert KeyValue to PublicKey");
    } else {
        return publicKey;
    }
}
 
Example #15
Source File: DOMKeyValue.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public PublicKey getPublicKey() throws KeyException {
    if (publicKey == null) {
        throw new KeyException("can't convert KeyValue to PublicKey");
    } else {
        return publicKey;
    }
}
 
Example #16
Source File: DOMKeyValue.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public PublicKey getPublicKey() throws KeyException {
    if (publicKey == null) {
        throw new KeyException("can't convert KeyValue to PublicKey");
    } else {
        return publicKey;
    }
}
 
Example #17
Source File: SSHInfrastructure.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Configures the Infrastructure
 *
 * @param parameters
 *            parameters[4] : ssh Options, see {@link SSHClient}
 *            parameters[5] : java path on the remote machines
 *            parameters[6] : Scheduling path on remote machines
 *            parameters[7] : target OS' type (Linux, Windows or Cygwin)
 *            parameters[8] : extra java options
 *            parameters[9] : rm cred
 * @throws IllegalArgumentException
 *             configuration failed
 */
@Override
public void configure(Object... parameters) {
    super.configure(parameters);
    int index = 4;
    if (parameters != null && parameters.length >= 10) {
        this.sshOptions = parameters[index++].toString();
        this.javaPath = parameters[index++].toString();
        if (this.javaPath == null || this.javaPath.equals("")) {
            throw new IllegalArgumentException("A valid Java path must be supplied.");
        }
        this.schedulingPath = parameters[index++].toString();
        // target OS
        if (parameters[index] != null) {
            OperatingSystem configuredTargetOs = OperatingSystem.getOperatingSystem(parameters[index++].toString());
            if (configuredTargetOs == null) {
                throw new IllegalArgumentException("Only 'Linux', 'Windows' and 'Cygwin' are valid values for Target OS Property.");
            }
            persistedInfraVariables.put(TARGET_OS_OBJ_KEY, configuredTargetOs);
        } else {
            throw new IllegalArgumentException("Target OS parameter cannot be null");
        }

        this.javaOptions = parameters[index++].toString();

        // credentials
        try {
            byte[] possibleCredentials = (byte[]) parameters[index++];
            if (possibleCredentials != null && possibleCredentials.length > 0) {
                persistedInfraVariables.put(CREDENTIALS_KEY, Credentials.getCredentialsBase64(possibleCredentials));
            }
        } catch (KeyException e) {
            throw new IllegalArgumentException("Could not retrieve base64 credentials", e);
        }
    } else {
        throw new IllegalArgumentException("Invalid parameters for infrastructure creation");
    }
}
 
Example #18
Source File: SharedSessionStoreTestUtils.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
public static String createValidSession(RMProxyUserInterface rm)
        throws ActiveObjectCreationException, NodeException, RMException, KeyException, LoginException {
    SchedulerRMProxyFactory schedulerFactory = mock(SchedulerRMProxyFactory.class);
    when(schedulerFactory.connectToRM(Matchers.<CredData> any())).thenReturn(rm);
    SharedSessionStore.getInstance().setSchedulerRMProxyFactory(schedulerFactory);

    // login
    Session session = SharedSessionStore.getInstance().createUnnamedSession();
    session.connectToRM(new CredData());
    return session.getSessionId();
}
 
Example #19
Source File: SchedulerFrontend.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
@ImmediateService
public void putThirdPartyCredential(String key, String value) throws NotConnectedException, PermissionException {
    UserIdentificationImpl ident = frontendState.checkPermission("putThirdPartyCredential",
                                                                 YOU_DO_NOT_HAVE_PERMISSION_TO_PUT_THIRD_PARTY_CREDENTIALS_IN_THE_SCHEDULER);

    HybridEncryptionUtil.HybridEncryptedData encryptedData = null;
    try {
        encryptedData = HybridEncryptionUtil.encryptString(value, corePublicKey);
    } catch (KeyException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
    dbManager.putThirdPartyCredential(ident.getUsername(), key, encryptedData);
}
 
Example #20
Source File: DOMKeyValue.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
DSA(PublicKey key) throws KeyException {
    super(key);
    DSAPublicKey dkey = (DSAPublicKey) key;
    DSAParams params = dkey.getParams();
    p = new DOMCryptoBinary(params.getP());
    q = new DOMCryptoBinary(params.getQ());
    g = new DOMCryptoBinary(params.getG());
    y = new DOMCryptoBinary(dkey.getY());
}
 
Example #21
Source File: RSAPublicKey.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the key in its primary encoding format, or null
 * if this key does not support encoding.
 *
 * @return the encoded key, or null if the key does not support
 * encoding.
 */
public byte[] getEncoded()
{
    if (encoding == null) {

        try {
            encoding = new RSAPublicKeyImpl(getModulus(),
                getPublicExponent()).getEncoded();

        } catch (KeyException e) {
            // ignore
        }
    }
    return encoding;
}
 
Example #22
Source File: CPublicKey.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public byte[] getEncoded() {
    if (encoding == null) {
        try {
            encoding = RSAPublicKeyImpl.newKey(KeyType.RSA, null,
                    getModulus(), getPublicExponent()).getEncoded();
        } catch (KeyException e) {
            // ignore
        }
    }
    return encoding;
}
 
Example #23
Source File: DOMKeyValue.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
DSA(PublicKey key) throws KeyException {
    super(key);
    DSAPublicKey dkey = (DSAPublicKey) key;
    DSAParams params = dkey.getParams();
    p = new DOMCryptoBinary(params.getP());
    q = new DOMCryptoBinary(params.getQ());
    g = new DOMCryptoBinary(params.getG());
    y = new DOMCryptoBinary(dkey.getY());
}
 
Example #24
Source File: DOMKeyValue.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
EC(PublicKey key) throws KeyException {
    super(key);
    ECPublicKey ecKey = (ECPublicKey)key;
    ECPoint ecPoint = ecKey.getW();
    ecParams = ecKey.getParams();
    ecPublicKey = encodePoint(ecPoint, ecParams.getCurve());
}
 
Example #25
Source File: WarWrapperTest.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
@BeforeClass
public static void setup() throws KeyException, IOException {

    warWrapper = WarWrapper.INSTANCE;
    warWrapper.launchProactive();
    credentials = warWrapper.getCredentials();
}
 
Example #26
Source File: ForkedTaskExecutorTest.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
private Decrypter createCredentials(String username) throws NoSuchAlgorithmException, KeyException {
    CredData credData = new CredData(username, "pwd");
    KeyPairGenerator keyGen;
    keyGen = KeyPairGenerator.getInstance("RSA");
    keyGen.initialize(512, new SecureRandom());
    KeyPair keyPair = keyGen.generateKeyPair();
    Decrypter decrypter = new Decrypter(keyPair.getPrivate());
    Credentials credentials = Credentials.createCredentials(credData, keyPair.getPublic());
    decrypter.setCredentials(credentials);
    return decrypter;
}
 
Example #27
Source File: DOMKeyValue.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
EC(PublicKey key) throws KeyException {
    super(key);
    ECPublicKey ecKey = (ECPublicKey)key;
    ECPoint ecPoint = ecKey.getW();
    ecParams = ecKey.getParams();
    try {
        AccessController.doPrivileged(
            new PrivilegedExceptionAction<Void>() {
                public Void run() throws
                    ClassNotFoundException, NoSuchMethodException
                {
                    getMethods();
                    return null;
                }
            }
        );
    } catch (PrivilegedActionException pae) {
        throw new KeyException("ECKeyValue not supported",
                                pae.getException());
    }
    Object[] args = new Object[] { ecPoint, ecParams.getCurve() };
    try {
        ecPublicKey = (byte[])encodePoint.invoke(null, args);
    } catch (IllegalAccessException iae) {
        throw new KeyException(iae);
    } catch (InvocationTargetException ite) {
        throw new KeyException(ite);
    }
}
 
Example #28
Source File: DOMKeyInfoFactory.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public KeyValue newKeyValue(PublicKey key)  throws KeyException {
    String algorithm = key.getAlgorithm();
    if (algorithm.equals("DSA")) {
        return new DOMKeyValue.DSA(key);
    } else if (algorithm.equals("RSA")) {
        return new DOMKeyValue.RSA(key);
    } else if (algorithm.equals("EC")) {
        return new DOMKeyValue.EC(key);
    } else {
        throw new KeyException("unsupported key algorithm: " + algorithm);
    }
}
 
Example #29
Source File: KeyExceptionTest.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * Test for <code>KeyException(String)</code> constructor Assertion:
 * constructs KeyException when <code>msg</code> is null
 */
public void testKeyException03() {
    String msg = null;
    KeyException tE = new KeyException(msg);
    assertNull("getMessage() must return null.", tE.getMessage());
    assertNull("getCause() must return null", tE.getCause());
}
 
Example #30
Source File: ManageUsers.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
private static void createAccount(PublicKey pubKey, UserInfo userInfo, String loginFilePath, String groupFilePath,
        Properties props, Multimap<String, String> groupsMap) throws ManageUsersException, KeyException {
    if (!userInfo.isLoginSet()) {
        warnWithMessage(PROVIDED_USERNAME + IS_EMPTY_SKIPPING);
        return;
    }
    if (!userInfo.isPasswordSet()) {
        warnWithMessage("Provided password for user " + userInfo.getLogin() + IS_EMPTY_SKIPPING);
        return;
    }
    if (!userInfo.isGroupSet()) {
        warnWithMessage("Provided groups for user " + userInfo.getLogin() + IS_EMPTY_SKIPPING);
        return;
    }
    if (props.containsKey(userInfo.getLogin())) {
        warnWithMessage(USER_HEADER + userInfo.getLogin() + ALREADY_EXISTS_IN_LOGIN_FILE + loginFilePath +
                        UPDATING_THIS_USER_INFORMATION);
    }
    if (groupsMap.containsKey(userInfo.getLogin())) {
        warnWithMessage(USER_HEADER + userInfo.getLogin() + ALREADY_EXISTS_IN_GROUP_FILE + groupFilePath +
                        UPDATING_THIS_USER_INFORMATION);
    }
    updateUserPassword(pubKey, userInfo.getLogin(), userInfo.getPassword(), props);
    updateUserGroups(userInfo.getLogin(), userInfo.getGroups(), groupsMap);
    System.out.println("Created user " + userInfo.getLogin());

}