EncodePasswordTestCase.java revision 378931eeabc8709b956de2da88403d571c4aac07
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence/*
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * CDDL HEADER START
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence *
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * The contents of this file are subject to the terms of the
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * Common Development and Distribution License, Version 1.0 only
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * (the "License"). You may not use this file except in compliance
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * with the License.
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence *
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * You can obtain a copy of the license at
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * trunk/opends/resource/legal-notices/OpenDS.LICENSE
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * See the License for the specific language governing permissions
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * and limitations under the License.
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence *
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * When distributing Covered Code, include this CDDL HEADER in each
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence * file and include the License file at
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley * add the following below this CDDL HEADER, with the fields enclosed
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley * by brackets "[]" replaced with your own identifying information:
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley * Portions Copyright [yyyy] [name of copyright owner]
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley *
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley * CDDL HEADER END
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley *
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley *
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff * Portions Copyright 2006-2007 Sun Microsystems, Inc.
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff */
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graffpackage org.opends.server.tools;
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graffimport java.io.File;
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graffimport java.io.FileWriter;
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graffimport java.util.ArrayList;
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graffimport org.testng.annotations.BeforeClass;
75a4dd0d377dca2f85cea44e28bf110314c1fe8cDavid Lawrenceimport org.testng.annotations.DataProvider;
75a4dd0d377dca2f85cea44e28bf110314c1fe8cDavid Lawrenceimport org.testng.annotations.Test;
75a4dd0d377dca2f85cea44e28bf110314c1fe8cDavid Lawrence
75a4dd0d377dca2f85cea44e28bf110314c1fe8cDavid Lawrenceimport org.opends.server.TestCaseUtils;
75a4dd0d377dca2f85cea44e28bf110314c1fe8cDavid Lawrenceimport org.opends.server.core.AddOperation;
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrenceimport org.opends.server.core.DirectoryServer;
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrenceimport org.opends.server.protocols.internal.InternalClientConnection;
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrenceimport org.opends.server.protocols.ldap.LDAPResultCode;
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrenceimport org.opends.server.types.Entry;
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrenceimport org.opends.server.types.OperatingSystem;
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrenceimport org.opends.server.types.ResultCode;
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrenceimport org.opends.server.util.Base64;
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrenceimport static org.testng.Assert.*;
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrenceimport static org.opends.server.util.ServerConstants.*;
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence/**
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * A set of test cases for the EncodePassword tool.
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence */
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrencepublic class EncodePasswordTestCase
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence extends ToolsTestCase
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence{
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence // The path to the Directory Server configuration file.
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence private String configFilePath;
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence // The path to the temporary file containing a password.
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence private String passwordFilePath;
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence /**
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence * Ensures that the Directory Server is running and gets the config file path.
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence *
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence * @throws Exception If an unexpected problem occurs.
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence */
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence @BeforeClass()
ae4cbb69eef32ced103fe4561e8d2031ee4c3497David Lawrence public void startServer()
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence throws Exception
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence {
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence TestCaseUtils.startServer();
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence configFilePath = DirectoryServer.getServerRoot() + File.separator +
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "config" + File.separator + "config.ldif";
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence passwordFilePath = TestCaseUtils.createTempFile("password");
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence }
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence /**
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * Retrieves sets of invalid arguments that may not be used to initialize
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * the EncodePassword tool.
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence *
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence * @return Sets of invalid arguments that may not be used to initialize the
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence * EncodePassword tool.
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence */
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence @DataProvider(name = "invalidArgs")
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence public Object[][] getInvalidArgumentLists()
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence {
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence ArrayList<String[]> argLists = new ArrayList<String[]>();
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence ArrayList<String> reasonList = new ArrayList<String>();
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence String[] args = new String[] {};
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence argLists.add(args);
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence reasonList.add("No arguments");
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence args = new String[]
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence {
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "-C",
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence };
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence argLists.add(args);
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff reasonList.add("No value for '-C' argument");
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff args = new String[]
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff {
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff "-f",
1ce985ab3c6670662d555c108b35fed84a6a1001David Lawrence };
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence argLists.add(args);
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence reasonList.add("No value for '-f' argument");
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence args = new String[]
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence {
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "-c",
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence };
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence argLists.add(args);
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence reasonList.add("No value for '-c' argument");
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence args = new String[]
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence {
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence "-F",
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence };
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence argLists.add(args);
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence reasonList.add("No value for '-F' argument");
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence args = new String[]
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence {
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence "-e",
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence };
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence argLists.add(args);
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff reasonList.add("No value for '-e' argument");
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff args = new String[]
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff {
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff "-E",
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff };
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff argLists.add(args);
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff reasonList.add("No value for '-E' argument");
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff
657ce0b9d84fbd66514df53d61a087e8f1161187Michael Graff args = new String[]
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence {
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "-s",
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence };
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence argLists.add(args);
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence reasonList.add("No value for '-s' argument");
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson args = new String[]
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson {
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson "-I"
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson };
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson argLists.add(args);
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence reasonList.add("Invalid short argument");
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson args = new String[]
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson {
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence "--invalidLongArgument"
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson };
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson argLists.add(args);
971d1fe83172bce09d6319c5735d243d68d8cb47Andreas Gustafsson reasonList.add("Invalid long argument");
971d1fe83172bce09d6319c5735d243d68d8cb47Andreas Gustafsson
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence args = new String[]
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence {
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--configFile", configFilePath
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson };
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson argLists.add(args);
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson reasonList.add("No clear password");
971d1fe83172bce09d6319c5735d243d68d8cb47Andreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson args = new String[]
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson {
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson "--configFile", configFilePath,
971d1fe83172bce09d6319c5735d243d68d8cb47Andreas Gustafsson "--clearPassword", "password"
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson };
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson argLists.add(args);
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson reasonList.add("No storage scheme or encoded password");
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson args = new String[]
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson {
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson "--configFile", configFilePath,
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson "--clearPassword", "password",
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson "--clearPasswordFile", passwordFilePath,
971d1fe83172bce09d6319c5735d243d68d8cb47Andreas Gustafsson "--storageScheme", "SSHA"
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson };
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson argLists.add(args);
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson reasonList.add("Both clear password and clear password file");
6182613ef54ebb8369d951ffa4431c49b75cec51Mark Andrews
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson args = new String[]
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson {
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson "--configFile", configFilePath,
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson "--clearPassword", "password",
971d1fe83172bce09d6319c5735d243d68d8cb47Andreas Gustafsson "--encodedPassword", "password",
971d1fe83172bce09d6319c5735d243d68d8cb47Andreas Gustafsson "--encodedPasswordFile", passwordFilePath
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence };
2c7e99b941c3f1ffa29f9034c710f358c09f13c9Michael Graff argLists.add(args);
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson reasonList.add("Both encoded password and encoded password file");
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson Object[][] returnArray = new Object[argLists.size()][2];
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson for (int i=0; i < argLists.size(); i++)
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson {
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson returnArray[i][0] = argLists.get(i);
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson returnArray[i][1] = reasonList.get(i);
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson }
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson return returnArray;
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson }
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley /**
13494a4d4bead37f22eb6c4779c73310109f7e4aJames Brister * Tests the EncodePassword tool with sets of invalid arguments.
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley *
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley * @param args The set of arguments to use for the ListBackends
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence * tool.
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley * @param invalidReason The reason the provided set of arguments is invalid.
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence */
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence @Test(dataProvider = "invalidArgs")
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence public void testInvalidArguments(String[] args, String invalidReason)
2b556032fd78aff37e80e755044b944a017245cdDavid Lawrence {
2b556032fd78aff37e80e755044b944a017245cdDavid Lawrence assertFalse((EncodePassword.encodePassword(args, false, null, null) == 0),
2b556032fd78aff37e80e755044b944a017245cdDavid Lawrence "Should have been invalid because: " + invalidReason);
35c842e05dc6382ce1d9161a658d3ff4b2c3d4c9Bob Halley }
2b556032fd78aff37e80e755044b944a017245cdDavid Lawrence
2b556032fd78aff37e80e755044b944a017245cdDavid Lawrence
2b556032fd78aff37e80e755044b944a017245cdDavid Lawrence
35c842e05dc6382ce1d9161a658d3ff4b2c3d4c9Bob Halley /**
2b556032fd78aff37e80e755044b944a017245cdDavid Lawrence * Tests the EncodePassword tool with the --listSchemes argument.
2b556032fd78aff37e80e755044b944a017245cdDavid Lawrence */
2b556032fd78aff37e80e755044b944a017245cdDavid Lawrence @Test()
35c842e05dc6382ce1d9161a658d3ff4b2c3d4c9Bob Halley public void testListSchemes()
2b556032fd78aff37e80e755044b944a017245cdDavid Lawrence {
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley String[] args =
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley {
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley "--configFile", configFilePath,
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley "--listSchemes"
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley };
a2171e092382f8f8a72b1f73436ddf93918c7719Bob Halley
a2171e092382f8f8a72b1f73436ddf93918c7719Bob Halley assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
7c0876aa42e6abaa8779bcb83962ccf20a9f4da3Bob Halley }
a2171e092382f8f8a72b1f73436ddf93918c7719Bob Halley
491b48ec3f3ef014312688776ddbd4eab8a2c10cMichael Graff
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence /**
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * Tests the EncodePassword tool with the --listSchemes and
12ccbb032ec1b5f6b93aac923f2645a19fc90c75David Lawrence * --authPasswordSyntax arguments.
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley */
12ccbb032ec1b5f6b93aac923f2645a19fc90c75David Lawrence @Test()
12ccbb032ec1b5f6b93aac923f2645a19fc90c75David Lawrence public void testListAuthSchemes()
12ccbb032ec1b5f6b93aac923f2645a19fc90c75David Lawrence {
12ccbb032ec1b5f6b93aac923f2645a19fc90c75David Lawrence String[] args =
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley {
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley "--configFile", configFilePath,
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--listSchemes",
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence "--authPasswordSyntax"
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence };
a505a3f6e09218bebac020fc49105b2e6cd9e25cBob Halley
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence }
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence
a505a3f6e09218bebac020fc49105b2e6cd9e25cBob Halley
a505a3f6e09218bebac020fc49105b2e6cd9e25cBob Halley
a505a3f6e09218bebac020fc49105b2e6cd9e25cBob Halley /**
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence * Tests the EncodePassword tool with the --clearPassword and --storageScheme
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence * arguments.
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence */
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence @Test()
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence public void testEncodeClearPassword()
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence {
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence String[] args =
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence {
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence "--configFile", configFilePath,
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence "--clearPassword", "password",
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence "--storageScheme", "SSHA"
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence };
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence }
566a01eb745d49bd866971062388cd11d525b60dDavid Lawrence
1ce985ab3c6670662d555c108b35fed84a6a1001David Lawrence
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley /**
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley * Tests the EncodePassword tool with the --clearPassword, --storageScheme,
facb97777a972f6c8035ca3e762a6a9248c12897Bob Halley * and --authPasswordSyntax arguments.
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence */
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence @Test()
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence public void testEncodeClearAuthPassword()
d8dcd6ad4617cc8d7df979bd62101fa9c4bac1bcBob Halley {
d8dcd6ad4617cc8d7df979bd62101fa9c4bac1bcBob Halley String[] args =
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence {
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--configFile", configFilePath,
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--clearPassword", "password",
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--storageScheme", "SHA1",
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--authPasswordSyntax"
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence };
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence }
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
882350d11c90de9de6fc1cead25690c8114b0b95Michael Graff
882350d11c90de9de6fc1cead25690c8114b0b95Michael Graff
882350d11c90de9de6fc1cead25690c8114b0b95Michael Graff /**
882350d11c90de9de6fc1cead25690c8114b0b95Michael Graff * Tests the EncodePassword tool with the --clearPasswordFile and
882350d11c90de9de6fc1cead25690c8114b0b95Michael Graff * --storageScheme arguments.
882350d11c90de9de6fc1cead25690c8114b0b95Michael Graff */
882350d11c90de9de6fc1cead25690c8114b0b95Michael Graff @Test()
882350d11c90de9de6fc1cead25690c8114b0b95Michael Graff public void testEncodeClearPasswordFromFile()
64ba6e4cc3a0ccf8c8c6349fa75b937ca9bad9a6Michael Graff {
694c897b20f06f8a5349fd9ac5df93947f6f5a2aBob Halley String[] args =
694c897b20f06f8a5349fd9ac5df93947f6f5a2aBob Halley {
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley "--configFile", configFilePath,
491b48ec3f3ef014312688776ddbd4eab8a2c10cMichael Graff "--clearPasswordFile", passwordFilePath,
9fbc1afb8b08432e3a1adda1f41d5575620e9785Bob Halley "--storageScheme", "SSHA"
1443aa0adf4d262abdf2721a5239acd4812cdc06Bob Halley };
1443aa0adf4d262abdf2721a5239acd4812cdc06Bob Halley
1443aa0adf4d262abdf2721a5239acd4812cdc06Bob Halley assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
1443aa0adf4d262abdf2721a5239acd4812cdc06Bob Halley }
083699db84de2f7cc534c06ed3502248329145d4Bob Halley
083699db84de2f7cc534c06ed3502248329145d4Bob Halley
083699db84de2f7cc534c06ed3502248329145d4Bob Halley
1ce985ab3c6670662d555c108b35fed84a6a1001David Lawrence /**
9fbc1afb8b08432e3a1adda1f41d5575620e9785Bob Halley * Tests the EncodePassword tool with the --clearPasswordFile, --storageScheme,
9fbc1afb8b08432e3a1adda1f41d5575620e9785Bob Halley * and --authPasswordSyntax arguments.
9fbc1afb8b08432e3a1adda1f41d5575620e9785Bob Halley */
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley @Test()
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley public void testEncodeClearAuthPasswordFromFile()
a2171e092382f8f8a72b1f73436ddf93918c7719Bob Halley {
68e46ce9ee6bbbc0e61e93f1705657d3ef83127bBob Halley String[] args =
694c897b20f06f8a5349fd9ac5df93947f6f5a2aBob Halley {
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley "--configFile", configFilePath,
1ce985ab3c6670662d555c108b35fed84a6a1001David Lawrence "--clearPasswordFile", passwordFilePath,
9fbc1afb8b08432e3a1adda1f41d5575620e9785Bob Halley "--storageScheme", "SHA1",
694c897b20f06f8a5349fd9ac5df93947f6f5a2aBob Halley "--authPasswordSyntax"
694c897b20f06f8a5349fd9ac5df93947f6f5a2aBob Halley };
9fbc1afb8b08432e3a1adda1f41d5575620e9785Bob Halley
7c0876aa42e6abaa8779bcb83962ccf20a9f4da3Bob Halley assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
16c46f3cf540d6e0fff38410ce04a0f26a8f883fBob Halley }
9ca8ad2a26061acc92f224354f1496a339a41a9eBob Halley
7c0876aa42e6abaa8779bcb83962ccf20a9f4da3Bob Halley
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley /**
694c897b20f06f8a5349fd9ac5df93947f6f5a2aBob Halley * Tests the EncodePassword tool with the --clearPassword and --storageScheme
694c897b20f06f8a5349fd9ac5df93947f6f5a2aBob Halley * arguments using an invalid storage scheme.
694c897b20f06f8a5349fd9ac5df93947f6f5a2aBob Halley */
491b48ec3f3ef014312688776ddbd4eab8a2c10cMichael Graff @Test()
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence public void testEncodeClearPasswordWithInvalidScheme()
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence {
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence String[] args =
28ed3013196c373745dbde87b75a490148dab840Bob Halley {
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson "--configFile", configFilePath,
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--clearPassword", "password",
ee7c4a9d17435299f152c4753f0a0dfc890e800aMichael Graff "--storageScheme", "invalid"
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson };
28ed3013196c373745dbde87b75a490148dab840Bob Halley
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley assertFalse(EncodePassword.encodePassword(args, false, null, null) == 0);
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence }
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
1922518d7f7b5e3e77b8e1c92569c98268b9c192Andreas Gustafsson
9cda9dc86efa0dde8f906759c4e3279da028b5f4Bob Halley /**
9cda9dc86efa0dde8f906759c4e3279da028b5f4Bob Halley * Tests the EncodePassword tool with the --clearPassword, --storageScheme,
9cda9dc86efa0dde8f906759c4e3279da028b5f4Bob Halley * and --authPasswordSyntax arguments using an invalid storage scheme.
70eb7879553eaa57c391f07e439911bfdaff7124Bob Halley */
9cda9dc86efa0dde8f906759c4e3279da028b5f4Bob Halley @Test()
35c842e05dc6382ce1d9161a658d3ff4b2c3d4c9Bob Halley public void testEncodeClearPasswordWithInvalidAuthScheme()
35c842e05dc6382ce1d9161a658d3ff4b2c3d4c9Bob Halley {
9cda9dc86efa0dde8f906759c4e3279da028b5f4Bob Halley String[] args =
35c842e05dc6382ce1d9161a658d3ff4b2c3d4c9Bob Halley {
35c842e05dc6382ce1d9161a658d3ff4b2c3d4c9Bob Halley "--configFile", configFilePath,
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley "--clearPassword", "password",
35c842e05dc6382ce1d9161a658d3ff4b2c3d4c9Bob Halley "--storageScheme", "invalid",
9cda9dc86efa0dde8f906759c4e3279da028b5f4Bob Halley "--authPasswordSyntax"
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence };
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence assertFalse(EncodePassword.encodePassword(args, false, null, null) == 0);
4c5faa6bcf41d8ba253b872a04105a2fcc88c07bMichael Graff }
4c5faa6bcf41d8ba253b872a04105a2fcc88c07bMichael Graff
4c5faa6bcf41d8ba253b872a04105a2fcc88c07bMichael Graff
4c5faa6bcf41d8ba253b872a04105a2fcc88c07bMichael Graff
4c5faa6bcf41d8ba253b872a04105a2fcc88c07bMichael Graff /**
4c5faa6bcf41d8ba253b872a04105a2fcc88c07bMichael Graff * Tests the EncodePassword tool with the --clearPasswordFile and
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley * --storageScheme arguments using an a password file that doesn't exist.
4c5faa6bcf41d8ba253b872a04105a2fcc88c07bMichael Graff */
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley @Test()
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley public void testEncodeClearPasswordFromMissingFile()
4c5faa6bcf41d8ba253b872a04105a2fcc88c07bMichael Graff {
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence String[] args =
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence {
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--configFile", configFilePath,
8671e8306b3f18abf0e19c2fb9d49205962e7ab7David Lawrence "--clearPasswordFile", passwordFilePath + ".missing",
8671e8306b3f18abf0e19c2fb9d49205962e7ab7David Lawrence "--storageScheme", "invalid"
6c327669ba1d9eca870572b930c46f43e781d4a3Andreas Gustafsson };
8671e8306b3f18abf0e19c2fb9d49205962e7ab7David Lawrence
8671e8306b3f18abf0e19c2fb9d49205962e7ab7David Lawrence assertFalse(EncodePassword.encodePassword(args, false, null, null) == 0);
8671e8306b3f18abf0e19c2fb9d49205962e7ab7David Lawrence }
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley
8671e8306b3f18abf0e19c2fb9d49205962e7ab7David Lawrence
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley /**
8671e8306b3f18abf0e19c2fb9d49205962e7ab7David Lawrence * Tests the EncodePassword tool with the --clearPasswordFile,
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * --storageScheme, and --authPasswordSyntax arguments using an a password
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * file that doesn't exist.
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence */
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews @Test()
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews public void testEncodeClearAuthPasswordFromMissingFile()
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews {
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews String[] args =
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews {
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews "--configFile", configFilePath,
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews "--clearPasswordFile", passwordFilePath + ".missing",
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews "--storageScheme", "invalid",
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews "--authPasswordSyntax"
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews };
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews assertFalse(EncodePassword.encodePassword(args, false, null, null) == 0);
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews }
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews /**
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews * Tests the EncodePassword tool by performing a comparison of clear-text
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews * with a valid matching encoded password.
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews */
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews @Test()
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews public void testCompareMatchingPasswordsNoScheme()
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews {
6182613ef54ebb8369d951ffa4431c49b75cec51Mark Andrews String[] args =
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews {
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews "--configFile", configFilePath,
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews "--clearPassword", "password",
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews "--encodedPassword", "{CLEAR}password"
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews };
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews
afb4ad8f988591bccae0ee2ac73b2fef5d969366Mark Andrews assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
afb4ad8f988591bccae0ee2ac73b2fef5d969366Mark Andrews }
afb4ad8f988591bccae0ee2ac73b2fef5d969366Mark Andrews
afb4ad8f988591bccae0ee2ac73b2fef5d969366Mark Andrews
afb4ad8f988591bccae0ee2ac73b2fef5d969366Mark Andrews
afb4ad8f988591bccae0ee2ac73b2fef5d969366Mark Andrews /**
afb4ad8f988591bccae0ee2ac73b2fef5d969366Mark Andrews * Tests the EncodePassword tool by performing a comparison of clear-text
afb4ad8f988591bccae0ee2ac73b2fef5d969366Mark Andrews * with a valid matching encoded password.
afb4ad8f988591bccae0ee2ac73b2fef5d969366Mark Andrews */
afb4ad8f988591bccae0ee2ac73b2fef5d969366Mark Andrews @Test()
afb4ad8f988591bccae0ee2ac73b2fef5d969366Mark Andrews public void testCompareMatchingPasswordsWithScheme()
0e7e4562fd8222047b8ccf3a508d95df4f81bc47Mark Andrews {
0e7e4562fd8222047b8ccf3a508d95df4f81bc47Mark Andrews String[] args =
0e7e4562fd8222047b8ccf3a508d95df4f81bc47Mark Andrews {
0e7e4562fd8222047b8ccf3a508d95df4f81bc47Mark Andrews "--configFile", configFilePath,
0e7e4562fd8222047b8ccf3a508d95df4f81bc47Mark Andrews "--clearPassword", "password",
0e7e4562fd8222047b8ccf3a508d95df4f81bc47Mark Andrews "--storageScheme", "CLEAR",
0e7e4562fd8222047b8ccf3a508d95df4f81bc47Mark Andrews "--encodedPassword", "password"
0e7e4562fd8222047b8ccf3a508d95df4f81bc47Mark Andrews };
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
23693a38979a5f30334176bd3ddd1c42004f55b2Mark Andrews }
23693a38979a5f30334176bd3ddd1c42004f55b2Mark Andrews
23693a38979a5f30334176bd3ddd1c42004f55b2Mark Andrews
23693a38979a5f30334176bd3ddd1c42004f55b2Mark Andrews
23693a38979a5f30334176bd3ddd1c42004f55b2Mark Andrews /**
23693a38979a5f30334176bd3ddd1c42004f55b2Mark Andrews * Tests the EncodePassword tool by performing a comparison of clear-text
23693a38979a5f30334176bd3ddd1c42004f55b2Mark Andrews * with a valid matching auth password.
23693a38979a5f30334176bd3ddd1c42004f55b2Mark Andrews */
b21d8bac45b614c39a106c9ee8137589328ea075Andreas Gustafsson @Test()
23693a38979a5f30334176bd3ddd1c42004f55b2Mark Andrews public void testCompareMatchingAuthPasswords()
a272a556314a892c0bd73bc302e08249f3d99ec2Mark Andrews {
700f1442882eda0cce05a51e8c6f820c51054e8eMark Andrews String[] args =
700f1442882eda0cce05a51e8c6f820c51054e8eMark Andrews {
a272a556314a892c0bd73bc302e08249f3d99ec2Mark Andrews "--configFile", configFilePath,
700f1442882eda0cce05a51e8c6f820c51054e8eMark Andrews "--clearPassword", "password",
700f1442882eda0cce05a51e8c6f820c51054e8eMark Andrews "--encodedPassword", "SHA1$dcKtMsOgc30=$MtHvXqXXJIRgxxw4xRXIY6ZLkQo=",
700f1442882eda0cce05a51e8c6f820c51054e8eMark Andrews "--authPasswordSyntax"
700f1442882eda0cce05a51e8c6f820c51054e8eMark Andrews };
700f1442882eda0cce05a51e8c6f820c51054e8eMark Andrews
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
40f24178432de09181bc603cc90110546a0ddca2Mark Andrews }
6182613ef54ebb8369d951ffa4431c49b75cec51Mark Andrews
6182613ef54ebb8369d951ffa4431c49b75cec51Mark Andrews
6182613ef54ebb8369d951ffa4431c49b75cec51Mark Andrews
6182613ef54ebb8369d951ffa4431c49b75cec51Mark Andrews /**
6182613ef54ebb8369d951ffa4431c49b75cec51Mark Andrews * Tests the EncodePassword tool by performing a comparison of clear-text
6182613ef54ebb8369d951ffa4431c49b75cec51Mark Andrews * with a non-matching encoded password.
6182613ef54ebb8369d951ffa4431c49b75cec51Mark Andrews */
6182613ef54ebb8369d951ffa4431c49b75cec51Mark Andrews @Test()
6182613ef54ebb8369d951ffa4431c49b75cec51Mark Andrews public void testCompareNonMatchingPasswordsNoScheme()
6182613ef54ebb8369d951ffa4431c49b75cec51Mark Andrews {
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews String[] args =
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews {
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews "--configFile", configFilePath,
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews "--clearPassword", "wrongpassword",
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews "--encodedPassword", "{CLEAR}password"
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews };
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews }
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews /**
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * Tests the EncodePassword tool by performing a comparison of clear-text
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence * with a non-matching encoded password.
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence */
ca485ab26fffa241a3eac1899b2d2012dd1fdb73Andreas Gustafsson @Test()
ca485ab26fffa241a3eac1899b2d2012dd1fdb73Andreas Gustafsson public void testCompareNonMatchingPasswordsWithScheme()
ca485ab26fffa241a3eac1899b2d2012dd1fdb73Andreas Gustafsson {
ca485ab26fffa241a3eac1899b2d2012dd1fdb73Andreas Gustafsson String[] args =
ca485ab26fffa241a3eac1899b2d2012dd1fdb73Andreas Gustafsson {
ca485ab26fffa241a3eac1899b2d2012dd1fdb73Andreas Gustafsson "--configFile", configFilePath,
ca485ab26fffa241a3eac1899b2d2012dd1fdb73Andreas Gustafsson "--clearPassword", "wrongpassword",
ca485ab26fffa241a3eac1899b2d2012dd1fdb73Andreas Gustafsson "--storageScheme", "CLEAR",
ca485ab26fffa241a3eac1899b2d2012dd1fdb73Andreas Gustafsson "--encodedPassword", "password"
ca485ab26fffa241a3eac1899b2d2012dd1fdb73Andreas Gustafsson };
ca485ab26fffa241a3eac1899b2d2012dd1fdb73Andreas Gustafsson
ca485ab26fffa241a3eac1899b2d2012dd1fdb73Andreas Gustafsson assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
ca485ab26fffa241a3eac1899b2d2012dd1fdb73Andreas Gustafsson }
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley /**
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence * Tests the EncodePassword tool by performing a comparison of clear-text
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley * with a non-matching auth password.
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley */
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley @Test()
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley public void testCompareNonMatchingAuthPasswords()
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley {
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley String[] args =
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley {
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley "--configFile", configFilePath,
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley "--clearPassword", "wrongpassword",
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley "--encodedPassword", "SHA1$dcKtMsOgc30=$MtHvXqXXJIRgxxw4xRXIY6ZLkQo=",
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley "--authPasswordSyntax"
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley };
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley }
193738b819e3c699f9edd18864a6810fcfcec855Andreas Gustafsson
193738b819e3c699f9edd18864a6810fcfcec855Andreas Gustafsson
193738b819e3c699f9edd18864a6810fcfcec855Andreas Gustafsson
193738b819e3c699f9edd18864a6810fcfcec855Andreas Gustafsson /**
193738b819e3c699f9edd18864a6810fcfcec855Andreas Gustafsson * Tests the EncodePassword tool by performing a comparison of clear-text
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley * with a valid matching encoded password using the LDAP compare result as an
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley * exit code.
193738b819e3c699f9edd18864a6810fcfcec855Andreas Gustafsson */
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley @Test()
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence public void testCompareMatchingPasswordsNoSchemeCompareResult()
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence {
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence String[] args =
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence {
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence "--configFile", configFilePath,
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence "--clearPassword", "password",
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--encodedPassword", "{CLEAR}password",
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--useCompareResultCode"
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence };
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence assertEquals(EncodePassword.encodePassword(args, false, null, null),
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence LDAPResultCode.COMPARE_TRUE);
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence }
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence
c0ef1acf49b383d8b6d3742cb963f7d08f5762e3Andreas Gustafsson
c0ef1acf49b383d8b6d3742cb963f7d08f5762e3Andreas Gustafsson
c0ef1acf49b383d8b6d3742cb963f7d08f5762e3Andreas Gustafsson /**
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence * Tests the EncodePassword tool by performing a comparison of clear-text
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence * with a valid matching encoded password using the LDAP compare result as an
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence * exit code.
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence */
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence @Test()
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence public void testCompareMatchingPasswordsWithSchemeCompareResult()
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence {
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence String[] args =
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence {
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence "--configFile", configFilePath,
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence "--clearPassword", "password",
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence "--storageScheme", "CLEAR",
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence "--encodedPassword", "password",
35c842e05dc6382ce1d9161a658d3ff4b2c3d4c9Bob Halley "--useCompareResultCode"
35c842e05dc6382ce1d9161a658d3ff4b2c3d4c9Bob Halley };
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence assertEquals(EncodePassword.encodePassword(args, false, null, null),
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence LDAPResultCode.COMPARE_TRUE);
35c842e05dc6382ce1d9161a658d3ff4b2c3d4c9Bob Halley }
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence /**
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence * Tests the EncodePassword tool by performing a comparison of clear-text
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence * with a valid matching auth password using the LDAP compare result as an
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence * exit code.
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley */
35c842e05dc6382ce1d9161a658d3ff4b2c3d4c9Bob Halley @Test()
0fde58a7673f28fcc08eb8f597581247a4c2db20Bob Halley public void testCompareMatchingAuthPasswordsCompareResult()
0fde58a7673f28fcc08eb8f597581247a4c2db20Bob Halley {
0fde58a7673f28fcc08eb8f597581247a4c2db20Bob Halley String[] args =
0fde58a7673f28fcc08eb8f597581247a4c2db20Bob Halley {
0fde58a7673f28fcc08eb8f597581247a4c2db20Bob Halley "--configFile", configFilePath,
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--clearPassword", "password",
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--encodedPassword", "SHA1$dcKtMsOgc30=$MtHvXqXXJIRgxxw4xRXIY6ZLkQo=",
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--authPasswordSyntax",
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence "--useCompareResultCode"
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence };
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence assertEquals(EncodePassword.encodePassword(args, false, null, null),
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence LDAPResultCode.COMPARE_TRUE);
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence }
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence /**
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence * Tests the EncodePassword tool by performing a comparison of clear-text
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence * with a non-matching encoded password using the LDAP compare result as an
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence * exit code.
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence */
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence @Test()
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence public void testCompareNonMatchingPasswordsNoSchemeCompareResult()
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence {
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence String[] args =
7bb707a34778fc4bd9624d6c5de95675424ea59fDavid Lawrence {
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence "--configFile", configFilePath,
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence "--clearPassword", "wrongpassword",
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence "--encodedPassword", "{CLEAR}password",
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence "--useCompareResultCode"
e32971f6c437485d21245d8a4a96af643b73eef4David Lawrence };
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence assertEquals(EncodePassword.encodePassword(args, false, null, null),
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence LDAPResultCode.COMPARE_FALSE);
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence }
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence /**
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence * Tests the EncodePassword tool by performing a comparison of clear-text
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence * with a non-matching encoded password using the LDAP compare result as an
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence * exit code.
8a9b755d32a4f6ace792ac3fd17c968cf96d2487David Lawrence */
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence @Test()
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence public void testCompareNonMatchingPasswordsWithSchemeCompareResult()
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence {
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence String[] args =
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence {
a456d4c310a791cc83edc995afdf7190f7c7296bBob Halley "--configFile", configFilePath,
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley "--clearPassword", "wrongpassword",
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley "--storageScheme", "CLEAR",
694c897b20f06f8a5349fd9ac5df93947f6f5a2aBob Halley "--encodedPassword", "password",
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley "--useCompareResultCode"
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley };
a456d4c310a791cc83edc995afdf7190f7c7296bBob Halley
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley assertEquals(EncodePassword.encodePassword(args, false, null, null),
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley LDAPResultCode.COMPARE_FALSE);
694c897b20f06f8a5349fd9ac5df93947f6f5a2aBob Halley }
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley
a456d4c310a791cc83edc995afdf7190f7c7296bBob Halley
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley /**
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley * Tests the EncodePassword tool by performing a comparison of clear-text
694c897b20f06f8a5349fd9ac5df93947f6f5a2aBob Halley * with a non-matching auth password using the LDAP compare result as an
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley * exit code.
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley */
1bb509f58b57f1d9ef413762fb9e3dd2bcaf7ed4Mark Andrews @Test()
1bb509f58b57f1d9ef413762fb9e3dd2bcaf7ed4Mark Andrews public void testCompareNonMatchingAuthPasswordsCompareResult()
1bb509f58b57f1d9ef413762fb9e3dd2bcaf7ed4Mark Andrews {
1bb509f58b57f1d9ef413762fb9e3dd2bcaf7ed4Mark Andrews String[] args =
1bb509f58b57f1d9ef413762fb9e3dd2bcaf7ed4Mark Andrews {
affd6c025b39ec89a91056efb084fff7239ad6e3Mark Andrews "--configFile", configFilePath,
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley "--clearPassword", "wrongpassword",
f7bf83d0cc099e754327f8da8c4d6d320da1de01Mark Andrews "--encodedPassword", "SHA1$dcKtMsOgc30=$MtHvXqXXJIRgxxw4xRXIY6ZLkQo=",
f7bf83d0cc099e754327f8da8c4d6d320da1de01Mark Andrews "--authPasswordSyntax",
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley "--useCompareResultCode"
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley };
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley assertEquals(EncodePassword.encodePassword(args, false, null, null),
51a659eb711eb6a17891675d3de6b8085a766ab2Mark Andrews LDAPResultCode.COMPARE_FALSE);
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley }
694c897b20f06f8a5349fd9ac5df93947f6f5a2aBob Halley
694c897b20f06f8a5349fd9ac5df93947f6f5a2aBob Halley
8a1930d026517e4733d680ac51abeb01353332c4Mark Andrews
8a1930d026517e4733d680ac51abeb01353332c4Mark Andrews /**
8a1930d026517e4733d680ac51abeb01353332c4Mark Andrews * Tests the EncodePassword tool by performing a comparison of clear-text
8a1930d026517e4733d680ac51abeb01353332c4Mark Andrews * with a malformed encoded auth password.
8a1930d026517e4733d680ac51abeb01353332c4Mark Andrews */
8a1930d026517e4733d680ac51abeb01353332c4Mark Andrews @Test()
8a1930d026517e4733d680ac51abeb01353332c4Mark Andrews public void testCompareInvalidEncodedAuthPassword()
8a1930d026517e4733d680ac51abeb01353332c4Mark Andrews {
8a1930d026517e4733d680ac51abeb01353332c4Mark Andrews String[] args =
5c00d1c90030a311d2700970fa7cffc8f828a48cBob Halley {
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--configFile", configFilePath,
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--clearPassword", "password",
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence "--encodedPassword", "malformedencodedauthpassword",
5c00d1c90030a311d2700970fa7cffc8f828a48cBob Halley "--authPasswordSyntax"
5c00d1c90030a311d2700970fa7cffc8f828a48cBob Halley };
5c00d1c90030a311d2700970fa7cffc8f828a48cBob Halley
5c00d1c90030a311d2700970fa7cffc8f828a48cBob Halley assertFalse(EncodePassword.encodePassword(args, false, null, null) == 0);
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence }
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence
6d5dcd0dc9bdbd679282b1ffc47987d24c3a1346Bob Halley
6d5dcd0dc9bdbd679282b1ffc47987d24c3a1346Bob Halley /**
6d5dcd0dc9bdbd679282b1ffc47987d24c3a1346Bob Halley * Tests the EncodePassword tool by performing a comparison of clear-text
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley * with an encoded password that uses an unknown scheme.
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley */
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence @Test()
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff public void testCompareEncodedPasswordWithUnknownScheme()
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley {
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley String[] args =
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley {
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence "--configFile", configFilePath,
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff "--clearPassword", "password",
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley "--encodedPassword", "{UNKNOWN}unknownscheme"
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley };
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence assertFalse(EncodePassword.encodePassword(args, false, null, null) == 0);
a3ab70dae26d009bf78b0594b2ab5eb9208f4b91Michael Graff }
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley /**
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley * Tests the EncodePassword tool by performing a comparison of clear-text
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley * with an encoded password that uses an unknown scheme.
6d5dcd0dc9bdbd679282b1ffc47987d24c3a1346Bob Halley */
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley @Test()
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley public void testCompareEncodedPasswordWithUnknownSeparateScheme()
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley {
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley String[] args =
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley {
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley "--configFile", configFilePath,
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley "--clearPassword", "password",
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley "--storageScheme", "unknown",
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley "--encodedPassword", "unknownscheme"
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley };
b2f85baf7905bad89781f8ef73003d4cfa955257Michael Graff
b2f85baf7905bad89781f8ef73003d4cfa955257Michael Graff assertFalse(EncodePassword.encodePassword(args, false, null, null) == 0);
b2f85baf7905bad89781f8ef73003d4cfa955257Michael Graff }
860728724ad298f60d5c6e7485d37c3b2b1ad632David Lawrence
860728724ad298f60d5c6e7485d37c3b2b1ad632David Lawrence
860728724ad298f60d5c6e7485d37c3b2b1ad632David Lawrence
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley /**
9fbc1afb8b08432e3a1adda1f41d5575620e9785Bob Halley * Tests the EncodePassword tool by performing a comparison of clear-text
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley * with an encoded auth password that uses an unknown scheme.
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley */
9fbc1afb8b08432e3a1adda1f41d5575620e9785Bob Halley @Test()
694c897b20f06f8a5349fd9ac5df93947f6f5a2aBob Halley public void testCompareEncodedAuthPasswordWithUnknownScheme()
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley {
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley String[] args =
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley {
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley "--configFile", configFilePath,
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley "--clearPassword", "password",
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley "--encodedPassword", "UNKNOWN$AUTH$SCHEME",
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley "--authPasswordSyntax"
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley };
d8dcd6ad4617cc8d7df979bd62101fa9c4bac1bcBob Halley
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley assertFalse(EncodePassword.encodePassword(args, false, null, null) == 0);
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley }
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley /**
65c4736d9c0ebc6d9b1d991593b55566909da9cdBrian Wellington * Tests the EncodePassword tool with the help options.
65c4736d9c0ebc6d9b1d991593b55566909da9cdBrian Wellington */
65c4736d9c0ebc6d9b1d991593b55566909da9cdBrian Wellington @Test()
65c4736d9c0ebc6d9b1d991593b55566909da9cdBrian Wellington public void testHelp()
65c4736d9c0ebc6d9b1d991593b55566909da9cdBrian Wellington {
65c4736d9c0ebc6d9b1d991593b55566909da9cdBrian Wellington String[] args = { "--help" };
65c4736d9c0ebc6d9b1d991593b55566909da9cdBrian Wellington assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
65c4736d9c0ebc6d9b1d991593b55566909da9cdBrian Wellington
f8e602a972e393cdacadd9852e0965bf1105dc7bMark Andrews args = new String[] { "-H" };
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael Graff assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael Graff
c68fa795a1c87fd5d0386e0503dc5666490ac77fMichael Graff args = new String[] { "-?" };
c7620c99f1139b77f14678e21a44f7c8c4236a7bMark Andrews assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
35c842e05dc6382ce1d9161a658d3ff4b2c3d4c9Bob Halley }
860728724ad298f60d5c6e7485d37c3b2b1ad632David Lawrence}
860728724ad298f60d5c6e7485d37c3b2b1ad632David Lawrence
860728724ad298f60d5c6e7485d37c3b2b1ad632David Lawrence