gpt4 book ai didi

com.github.robozonky.cli.ZonkoidPasswordFeature类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 12:50:26 27 4
gpt4 key购买 nike

本文整理了Java中com.github.robozonky.cli.ZonkoidPasswordFeature类的一些代码示例,展示了ZonkoidPasswordFeature类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonkoidPasswordFeature类的具体详情如下:
包路径:com.github.robozonky.cli.ZonkoidPasswordFeature
类名称: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());
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com