Examples of PasswordAnalysis


Examples of org.owasp.passfault.PasswordAnalysis

   */
  @Test
  public void testGetChars() {
    System.out.println("getChars");

    BackwardsAnalysisAdapter instance = new BackwardsAnalysisAdapter(new PasswordAnalysis("backwards"));
    CharSequence expResult = new StringBuilder("backwards").reverse().toString();
    CharSequence result = instance.getCharSequence();
    assertEquals(expResult, result);
  }

Examples of org.owasp.passfault.PasswordAnalysis

  @Test
  public void testAdaptedBackwards() {
    System.out.println("testAdaptedBackwards");

    {
      BackwardsAnalysisAdapter instance = new BackwardsAnalysisAdapter(new PasswordAnalysis(
          "012drow78"));
      //reversed would be= 87word210
      //it would find 'word' at index 2

      int reverseStartingIndex = 2;
      int actualStartingIndex = 3;
      assertAdaptedReverse(instance, reverseStartingIndex, actualStartingIndex);
    }
    {
      BackwardsAnalysisAdapter instance = new BackwardsAnalysisAdapter(new PasswordAnalysis(
          "012drow"));
      //reversed would be= word210
      //it would find 'word' at index 0

      int reverseStartingIndex = 0;
      int actualStartingIndex = 3;
      assertAdaptedReverse(instance, reverseStartingIndex, actualStartingIndex);
    }
    {
      BackwardsAnalysisAdapter instance = new BackwardsAnalysisAdapter(new PasswordAnalysis(
          "drow78"));
      //reversed would be= 87word
      //it would find 'word' at index 2

      int reverseStartingIndex = 2;

Examples of org.owasp.passfault.PasswordAnalysis

    //the above works in tomcat but not jetty or google app engine
    //the below works in jetty and google app engine but not tomcat
    SecureString password = getPassword(request.getInputStream(), request.getContentLength());
    CompositeFinder finder = getCompositeFinder();
    try{
      PasswordAnalysis analysis = new PasswordAnalysis(password);
      try {
        finder.analyze(analysis);
        finder.waitForAnalysis(analysis);
      } catch (Exception e) {
        throw new ServletException(e);

Examples of org.owasp.passfault.PasswordAnalysis

     * Test of analyze method, of class KeySequenceFinder.
     */
    @Test
    public void testAnalyze_right() throws Exception {
        System.out.println("analyze");
        PasswordAnalysis pass = new PasswordAnalysis("asdfg");
        KeySequenceFinder instance = new KeySequenceFinder(new EnglishKeyBoard());
        instance.analyze(pass);
        int count = pass.getPossiblePatternCount();
        assertEquals(6, count);
    }

Examples of org.owasp.passfault.PasswordAnalysis

     * Test of analyze method, of class KeySequenceFinder.
     */
    @Test
    public void testAnalyze_rightMixed() throws Exception {
        System.out.println("analyze");
        PasswordAnalysis pass = new PasswordAnalysis("aSdFg");
        KeySequenceFinder instance = new KeySequenceFinder(new EnglishKeyBoard());
        instance.analyze(pass);
        int count = pass.getPossiblePatternCount();
        assertEquals(6, count);
    }

Examples of org.owasp.passfault.PasswordAnalysis

    }
   
    @Test
    public void testAnalyze_left() throws Exception {
        System.out.println("analyze");
        PasswordAnalysis pass = new PasswordAnalysis("[poi");
        KeySequenceFinder instance = new KeySequenceFinder(new EnglishKeyBoard());
        instance.analyze(pass);
        int count = pass.getPossiblePatternCount();
        assertEquals(3, count);
    }

Examples of org.owasp.passfault.PasswordAnalysis

    }
   
    @Test
    public void testAnalyze_upperleft() throws Exception {
        System.out.println("analyze");
        PasswordAnalysis pass = new PasswordAnalysis("zaq1");
        KeySequenceFinder instance = new KeySequenceFinder(new EnglishKeyBoard());
        instance.analyze(pass);
        int count = pass.getPossiblePatternCount();
        assertEquals(3, count);
    }

Examples of org.owasp.passfault.PasswordAnalysis

    }
   
    @Test
    public void testAnalyze_upperright() throws Exception {
        System.out.println("analyze");
        PasswordAnalysis pass = new PasswordAnalysis("zse4");
        KeySequenceFinder instance = new KeySequenceFinder(new EnglishKeyBoard());
        instance.analyze(pass);
        int count = pass.getPossiblePatternCount();
        assertEquals(3, count);
    }

Examples of org.owasp.passfault.PasswordAnalysis

        assertEquals(3, count);
    }
    @Test
    public void testAnalyze_lowerleft() throws Exception {
        System.out.println("analyze");
        PasswordAnalysis pass = new PasswordAnalysis("4esz");
        KeySequenceFinder instance = new KeySequenceFinder(new EnglishKeyBoard());
        instance.analyze(pass);
        int count = pass.getPossiblePatternCount();
        assertEquals(3, count);
    }

Examples of org.owasp.passfault.PasswordAnalysis

    }
   
    @Test
    public void testAnalyze_lowerright() throws Exception {
        System.out.println("analyze");
        PasswordAnalysis pass = new PasswordAnalysis("1qaz");
        KeySequenceFinder instance = new KeySequenceFinder(new EnglishKeyBoard());
        instance.analyze(pass);
        int count = pass.getPossiblePatternCount();
        assertEquals(3, count);
    }
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.