本文整理了Java中com.github.robozonky.cli.ZonkoidPasswordFeature
类的一些代码示例,展示了ZonkoidPasswordFeature
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonkoidPasswordFeature
类的具体详情如下:
包路径:com.github.robozonky.cli.ZonkoidPasswordFeature
类名称:ZonkoidPasswordFeature
暂无
代码示例来源:origin: com.github.robozonky/robozonky-installer
private static void prepareZonkoid(final char... keystorePassword) throws SetupFailedException {
final Feature f = new ZonkoidPasswordFeature(KEYSTORE_FILE, keystorePassword,
Variables.ZONKOID_TOKEN.getValue(DATA).toCharArray());
f.setup();
}
代码示例来源:origin: com.github.robozonky/robozonky-cli
@Override
public void test() throws TestFailedException {
super.test();
final SecretProvider s = SecretProvider.keyStoreBased(this.getStorage());
final Optional<ConfirmationProvider> zonkoid = ConfirmationProviderLoader.load(id);
if (zonkoid.isPresent()) {
if (!Checker.confirmations(zonkoid.get(), s.getUsername(), s.getSecret(id).get())) {
throw new TestFailedException("Could not connect to Zonkoid, check log for details.");
}
} else {
throw new TestFailedException("Could not find Zonkoid provider.");
}
}
}
代码示例来源:origin: RoboZonky/robozonky
@Override
public void test() throws TestFailedException {
super.test();
final SecretProvider s = SecretProvider.keyStoreBased(this.getStorage());
final Optional<ConfirmationProvider> zonkoid = ConfirmationProviderLoader.load(id);
if (zonkoid.isPresent()) {
if (!Checker.confirmations(zonkoid.get(), s.getUsername(), s.getSecret(id).get())) {
throw new TestFailedException("Could not connect to Zonkoid, check log for details.");
}
} else {
throw new TestFailedException("Could not find Zonkoid provider.");
}
}
}
代码示例来源:origin: RoboZonky/robozonky
private static void prepareZonkoid(final char... keystorePassword) throws SetupFailedException {
final Feature f = new ZonkoidPasswordFeature(KEYSTORE_FILE, keystorePassword,
Variables.ZONKOID_TOKEN.getValue(DATA).toCharArray());
f.setup();
}
代码示例来源:origin: com.github.robozonky/robozonky-cli
@Override
public void setup() throws SetupFailedException {
super.setup();
final SecretProvider s = SecretProvider.keyStoreBased(this.getStorage());
try {
s.getUsername(); // ensure we have Zonky username prepared
s.setSecret(id, password);
} catch (final Exception ex) {
throw new SetupFailedException(ex);
}
}
代码示例来源:origin: RoboZonky/robozonky
@Test
void testFailsWithoutSetup() throws IOException {
final File f = newTempFile();
final String pwd = UUID.randomUUID().toString();
final Feature feature = new ZonkoidPasswordFeature("fakeId", f, KEYSTORE_PASSWORD.toCharArray(),
pwd.toCharArray());
assertThatThrownBy(feature::test).isInstanceOf(TestFailedException.class); // no setup performed
}
}
代码示例来源:origin: RoboZonky/robozonky
@Override
public void setup() throws SetupFailedException {
super.setup();
final SecretProvider s = SecretProvider.keyStoreBased(this.getStorage());
try {
s.getUsername(); // ensure we have Zonky username prepared
s.setSecret(id, password);
} catch (final Exception ex) {
throw new SetupFailedException(ex);
}
}
代码示例来源:origin: RoboZonky/robozonky
@Test
void createNewWithoutUsername() throws IOException {
final File f = newTempFile();
final String pwd = UUID.randomUUID().toString();
final Feature feature = new ZonkoidPasswordFeature(f, KEYSTORE_PASSWORD.toCharArray(), pwd.toCharArray());
assertThatThrownBy(feature::setup).isInstanceOf(SetupFailedException.class);
}
代码示例来源:origin: RoboZonky/robozonky
@Test
void testFailsWithNonexistentProvider() throws IOException, KeyStoreException,
SetupFailedException {
final File f = newTempFile();
final String pwd = UUID.randomUUID().toString();
SecretProvider.keyStoreBased(KeyStoreHandler.create(f, KEYSTORE_PASSWORD.toCharArray()), "user"); // prep
final Feature feature = new ZonkoidPasswordFeature("fakeId", f, KEYSTORE_PASSWORD.toCharArray(),
pwd.toCharArray());
feature.setup();
assertThatThrownBy(feature::test).isInstanceOf(TestFailedException.class); // fails due to non-existent provider
}
代码示例来源:origin: RoboZonky/robozonky
@Test
void openProperExistingFailing() throws IOException, SetupFailedException, KeyStoreException, TestFailedException {
final File f = newTempFile();
final String pwd = UUID.randomUUID().toString();
SecretProvider.keyStoreBased(KeyStoreHandler.create(f, KEYSTORE_PASSWORD.toCharArray()), "user"); // prep
final Feature feature = new ZonkoidPasswordFeature(f, KEYSTORE_PASSWORD.toCharArray(), pwd.toCharArray());
feature.setup();
final SecretProvider s = SecretProvider.keyStoreBased(KeyStoreHandler.open(f, KEYSTORE_PASSWORD.toCharArray()));
assertThat(s.getSecret(ZonkoidPasswordFeature.ZONKOID_ID)).contains(pwd.toCharArray());
assertThatThrownBy(feature::test).isInstanceOf(TestFailedException.class);
}
代码示例来源:origin: RoboZonky/robozonky
@Test
void openProperExistingSuccess() throws IOException, SetupFailedException, KeyStoreException, TestFailedException {
final File f = newTempFile();
final String pwd = UUID.randomUUID().toString();
SecretProvider.keyStoreBased(KeyStoreHandler.create(f, KEYSTORE_PASSWORD.toCharArray()), "user"); // prep
final Feature feature = new ZonkoidPasswordFeature(f, KEYSTORE_PASSWORD.toCharArray(), pwd.toCharArray());
feature.setup();
final SecretProvider s = SecretProvider.keyStoreBased(KeyStoreHandler.open(f, KEYSTORE_PASSWORD.toCharArray()));
assertThat(s.getSecret(ZonkoidPasswordFeature.ZONKOID_ID)).contains(pwd.toCharArray());
when(TestingZonkoidProviderService.INSTANCE.requestConfirmation(any(), anyInt(), anyInt())).thenReturn(true);
feature.test();
verify(TestingZonkoidProviderService.INSTANCE).requestConfirmation(any(), anyInt(), anyInt());
}
内容来源于网络,如有侵权,请联系作者删除!