gpt4 book ai didi

com.nulabinc.zxcvbn.Zxcvbn.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 00:19:31 29 4
gpt4 key购买 nike

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

Zxcvbn.<init>介绍

暂无

代码示例

代码示例来源:origin: nulab/zxcvbn4j

public JavaPortTest(String password) {
  this.password = password;
  zxcvbn = new Zxcvbn();
}

代码示例来源:origin: pwm-project/pwm

public static int judgePasswordStrengthUsingZxcvbnAlgorithm(
    final Configuration configuration,
    final String password
)
{
  final Zxcvbn zxcvbn = new Zxcvbn();
  final Strength strength = zxcvbn.measure( password );
  final int zxcvbnScore = strength.getScore();
  // zxcvbn returns a score of 0-4 (see: https://github.com/dropbox/zxcvbn)
  switch ( zxcvbnScore )
  {
    case 4:
      return Integer.parseInt( configuration.readAppProperty( AppProperty.PASSWORD_STRENGTH_THRESHOLD_VERY_STRONG ) );
    case 3:
      return Integer.parseInt( configuration.readAppProperty( AppProperty.PASSWORD_STRENGTH_THRESHOLD_STRONG ) );
    case 2:
      return Integer.parseInt( configuration.readAppProperty( AppProperty.PASSWORD_STRENGTH_THRESHOLD_GOOD ) );
    case 1:
      return Integer.parseInt( configuration.readAppProperty( AppProperty.PASSWORD_STRENGTH_THRESHOLD_WEAK ) );
    default:
      return Integer.parseInt( configuration.readAppProperty( AppProperty.PASSWORD_STRENGTH_THRESHOLD_VERY_WEAK ) );
  }
}

代码示例来源:origin: nulab/zxcvbn4j

@Test
public void testJapaneseWarning() {
  Zxcvbn zxcvbn = new Zxcvbn();
  Strength strength = zxcvbn.measure(password);
  Feedback feedback = strength.getFeedback();
  ResourceBundle resourceBundle = ResourceBundle.getBundle("com/nulabinc/zxcvbn/messages", Locale.JAPANESE);
  String expectedWarningL10n = expectedWarning.length() > 0 ? resourceBundle.getString(expectedWarning) : "";
  Assert.assertEquals("Unexpected warning", expectedWarningL10n, feedback.getWarning(Locale.JAPANESE));
}

代码示例来源:origin: nulab/zxcvbn4j

@Test
public void testWarning() {
  Zxcvbn zxcvbn = new Zxcvbn();
  Strength strength = zxcvbn.measure(password);
  Feedback feedback = strength.getFeedback();
  ResourceBundle resourceBundle = ResourceBundle.getBundle("com/nulabinc/zxcvbn/messages", Locale.ROOT);
  String expectedWarningL10n = expectedWarning.length() > 0 ? resourceBundle.getString(expectedWarning) : "";
  Assert.assertEquals("Unexpected warning", expectedWarningL10n, feedback.getWarning(Locale.ENGLISH));
}

代码示例来源:origin: nulab/zxcvbn4j

@Test
public void testSuggestions() {
  Zxcvbn zxcvbn = new Zxcvbn();
  Strength strength = zxcvbn.measure(password);
  Feedback feedback = strength.getFeedback();
  ResourceBundle resourceBundle = ResourceBundle.getBundle("com/nulabinc/zxcvbn/messages", Locale.ROOT);
  String[] expectedSuggestionsL10n = new String[expectedSuggestions.length];
  for (int i = 0; i < expectedSuggestions.length; i++) {
    String expectedSuggestion = expectedSuggestions[i];
    expectedSuggestionsL10n[i] = resourceBundle.getString(expectedSuggestion);
  }
  Assert.assertArrayEquals("Unexpected suggestions", expectedSuggestionsL10n, feedback.getSuggestions(Locale.ENGLISH).toArray());
}

代码示例来源:origin: nulab/zxcvbn4j

@Test
public void testJapaneseSuggestions() {
  Zxcvbn zxcvbn = new Zxcvbn();
  Strength strength = zxcvbn.measure(password);
  Feedback feedback = strength.getFeedback();
  ResourceBundle resourceBundle = ResourceBundle.getBundle("com/nulabinc/zxcvbn/messages", Locale.JAPANESE);
  String[] expectedSuggestionsL10n = new String[expectedSuggestions.length];
  for (int i = 0; i < expectedSuggestions.length; i++) {
    String expectedSuggestion = expectedSuggestions[i];
    expectedSuggestionsL10n[i] = resourceBundle.getString(expectedSuggestion);
  }
  Assert.assertArrayEquals("Unexpected suggestions", expectedSuggestionsL10n, feedback.getSuggestions(Locale.JAPANESE).toArray());
}

代码示例来源:origin: nulab/zxcvbn4j

@Test
public void testMeasure() throws Exception {
  Zxcvbn zxcvbn = new Zxcvbn();
  Strength strength = zxcvbn.measure(password);
  assertEquals("Unexpected error. Password is " + password, password, strength.getPassword());
}

代码示例来源:origin: nulab/zxcvbn4j

@Test
public void testUnknownSuggestions() {
  Zxcvbn zxcvbn = new Zxcvbn();
  Strength strength = zxcvbn.measure(password);
  Feedback feedback = strength.getFeedback().withResourceBundle(null);
  Assert.assertArrayEquals("Unexpected suggestions", expectedSuggestions, feedback.getSuggestions().toArray());
}

代码示例来源:origin: nulab/zxcvbn4j

@Test
public void testUnknownWarning() {
  Zxcvbn zxcvbn = new Zxcvbn();
  Strength strength = zxcvbn.measure(password);
  Feedback feedback = strength.getFeedback().withResourceBundle(null);
  Assert.assertEquals("Unexpected warning", expectedWarning, feedback.getWarning());
}

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